| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package com.google.debugging.sourcemap; |
| 18 |
|
| 19 |
import com.google.javascript.jscomp.SourceMap; |
| 20 |
import com.google.javascript.jscomp.SourceMap.Format; |
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
public class SourceMapGeneratorV1Test extends SourceMapTestCase { |
| 27 |
|
| 28 |
public SourceMapGeneratorV1Test() { |
| 29 |
disableColumnValidation(); |
| 30 |
} |
| 31 |
|
| 32 |
@Override |
| 33 |
protected SourceMapConsumer getSourceMapConsumer() { |
| 34 |
return new SourceMapConsumerV1(); |
| 35 |
} |
| 36 |
|
| 37 |
@Override |
| 38 |
protected Format getSourceMapFormat() { |
| 39 |
return SourceMap.Format.V1; |
| 40 |
} |
| 41 |
|
| 42 |
@Override |
| 43 |
public void setUp() { |
| 44 |
detailLevel = SourceMap.DetailLevel.ALL; |
| 45 |
} |
| 46 |
|
| 47 |
public void testBasicMapping() throws Exception { |
| 48 |
compileAndCheck("function __BASIC__() { }"); |
| 49 |
} |
| 50 |
|
| 51 |
public void testLiteralMappings() throws Exception { |
| 52 |
compileAndCheck("function __BASIC__(__PARAM1__, __PARAM2__) { " + |
| 53 |
"var __VAR__ = '__STR__'; }"); |
| 54 |
} |
| 55 |
|
| 56 |
public void testMultilineMapping() throws Exception { |
| 57 |
compileAndCheck("function __BASIC__(__PARAM1__, __PARAM2__) {\n" + |
| 58 |
"var __VAR__ = '__STR__';\n" + |
| 59 |
"var __ANO__ = \"__STR2__\";\n" + |
| 60 |
"}"); |
| 61 |
} |
| 62 |
|
| 63 |
public void testMultiFunctionMapping() throws Exception { |
| 64 |
compileAndCheck("function __BASIC__(__PARAM1__, __PARAM2__) {\n" + |
| 65 |
"var __VAR__ = '__STR__';\n" + |
| 66 |
"var __ANO__ = \"__STR2__\";\n" + |
| 67 |
"}\n\n" + |
| 68 |
|
| 69 |
"function __BASIC2__(__PARAM3__, __PARAM4__) {\n" + |
| 70 |
"var __VAR2__ = '__STR2__';\n" + |
| 71 |
"var __ANO2__ = \"__STR3__\";\n" + |
| 72 |
"}\n\n"); |
| 73 |
} |
| 74 |
|
| 75 |
public void testGoldenOutput0() throws Exception { |
| 76 |
|
| 77 |
checkSourceMap("", |
| 78 |
|
| 79 |
"/** Begin line maps. **/{ \"file\" : \"testcode\"," + |
| 80 |
" \"count\": 1 }\n" + |
| 81 |
|
| 82 |
"[]\n" + |
| 83 |
|
| 84 |
"/** Begin file information. **/\n" + |
| 85 |
"[]\n" + |
| 86 |
|
| 87 |
"/** Begin mapping definitions. **/\n"); |
| 88 |
} |
| 89 |
|
| 90 |
public void testFunctionNameOutput1() throws Exception { |
| 91 |
checkSourceMap("function f() {}", |
| 92 |
"/** Begin line maps. **/{ \"file\" : \"testcode\", " + |
| 93 |
"\"count\": 1 }\n" + |
| 94 |
|
| 95 |
"[0,0,0,0,0,0,0,0,1,1,2,2,3,3]\n" + |
| 96 |
|
| 97 |
"/** Begin file information. **/\n" + |
| 98 |
"[]\n" + |
| 99 |
|
| 100 |
"/** Begin mapping definitions. **/\n" + |
| 101 |
"[\"testcode\",1,0,\"f\"]\n" + |
| 102 |
"[\"testcode\",1,9,\"f\"]\n" + |
| 103 |
"[\"testcode\",1,10]\n" + |
| 104 |
"[\"testcode\",1,13]\n"); |
| 105 |
} |
| 106 |
|
| 107 |
public void testFunctionNameOutput2() throws Exception { |
| 108 |
checkSourceMap("a.b.c = function () {};", |
| 109 |
|
| 110 |
"/** Begin line maps. **/{ \"file\" : \"testcode\", " + |
| 111 |
"\"count\": 1 }\n" + |
| 112 |
|
| 113 |
"[3,2,2,1,1,0,4,4,4,4,4,4,4,4,5,5,6,6]\n" + |
| 114 |
|
| 115 |
"/** Begin file information. **/\n" + |
| 116 |
"[]\n" + |
| 117 |
|
| 118 |
"/** Begin mapping definitions. **/\n" + |
| 119 |
"[\"testcode\",1,0]\n" + |
| 120 |
"[\"testcode\",1,0,\"c\"]\n" + |
| 121 |
"[\"testcode\",1,0,\"b\"]\n" + |
| 122 |
"[\"testcode\",1,0,\"a\"]\n" + |
| 123 |
"[\"testcode\",1,8,\"a.b.c\"]\n" + |
| 124 |
"[\"testcode\",1,17]\n" + |
| 125 |
"[\"testcode\",1,20]\n"); |
| 126 |
} |
| 127 |
|
| 128 |
public void testFunctionNameOutput3() throws Exception { |
| 129 |
checkSourceMap("var q = function () {};", |
| 130 |
|
| 131 |
"/** Begin line maps. **/{ \"file\" : \"testcode\", " + |
| 132 |
"\"count\": 1 }\n" + |
| 133 |
|
| 134 |
"[0,0,0,0,1,1,2,2,2,2,2,2,2,2,3,3,4,4]\n" + |
| 135 |
|
| 136 |
"/** Begin file information. **/\n" + |
| 137 |
"[]\n" + |
| 138 |
|
| 139 |
"/** Begin mapping definitions. **/\n" + |
| 140 |
"[\"testcode\",1,0]\n" + |
| 141 |
"[\"testcode\",1,4,\"q\"]\n" + |
| 142 |
"[\"testcode\",1,8,\"q\"]\n" + |
| 143 |
"[\"testcode\",1,17]\n" + |
| 144 |
"[\"testcode\",1,20]\n"); |
| 145 |
} |
| 146 |
|
| 147 |
public void testFunctionNameOutput4() throws Exception { |
| 148 |
checkSourceMap("({ 'q' : function () {} })", |
| 149 |
|
| 150 |
"/** Begin line maps. **/{ \"file\" : \"testcode\", " + |
| 151 |
"\"count\": 1 }\n" + |
| 152 |
|
| 153 |
"[0,0,1,1,1,0,2,2,2,2,2,2,2,2,3,3,4,4,0,0]\n" + |
| 154 |
|
| 155 |
"/** Begin file information. **/\n" + |
| 156 |
"[]\n" + |
| 157 |
|
| 158 |
"/** Begin mapping definitions. **/\n" + |
| 159 |
"[\"testcode\",1,1]\n" + |
| 160 |
"[\"testcode\",1,3]\n" + |
| 161 |
"[\"testcode\",1,9,\"q\"]\n" + |
| 162 |
"[\"testcode\",1,18]\n" + |
| 163 |
"[\"testcode\",1,21]\n"); |
| 164 |
} |
| 165 |
|
| 166 |
public void testGoldenOutput1() throws Exception { |
| 167 |
detailLevel = SourceMap.DetailLevel.ALL; |
| 168 |
|
| 169 |
checkSourceMap("function f(foo, bar) { foo = foo + bar + 2; return foo; }", |
| 170 |
|
| 171 |
"/** Begin line maps. **/{ \"file\" : \"testcode\", " + |
| 172 |
"\"count\": 1 }\n" + |
| 173 |
|
| 174 |
"[0,0,0,0,0,0,0,0,1,1,2,3,3,3,2,4,4,4,2,5,7,7,7,6,8,8,8,6," + |
| 175 |
"9,9,9,6,10,11,11,11,11,11,11,11,12,12,12,12,5]\n" + |
| 176 |
|
| 177 |
"/** Begin file information. **/\n" + |
| 178 |
"[]\n" + |
| 179 |
|
| 180 |
"/** Begin mapping definitions. **/\n" + |
| 181 |
"[\"testcode\",1,0,\"f\"]\n" + |
| 182 |
"[\"testcode\",1,9,\"f\"]\n" + |
| 183 |
"[\"testcode\",1,10]\n" + |
| 184 |
"[\"testcode\",1,11,\"foo\"]\n" + |
| 185 |
"[\"testcode\",1,16,\"bar\"]\n" + |
| 186 |
"[\"testcode\",1,21]\n" + |
| 187 |
"[\"testcode\",1,23]\n" + |
| 188 |
"[\"testcode\",1,23,\"foo\"]\n" + |
| 189 |
"[\"testcode\",1,29,\"foo\"]\n" + |
| 190 |
"[\"testcode\",1,35,\"bar\"]\n" + |
| 191 |
"[\"testcode\",1,41]\n" + |
| 192 |
"[\"testcode\",1,44]\n" + |
| 193 |
"[\"testcode\",1,51,\"foo\"]\n"); |
| 194 |
|
| 195 |
|
| 196 |
detailLevel = SourceMap.DetailLevel.SYMBOLS; |
| 197 |
checkSourceMap("function f(foo, bar) { foo = foo + bar + 2; return foo; }", |
| 198 |
|
| 199 |
"/** Begin line maps. **/{ \"file\" : \"testcode\", " + |
| 200 |
"\"count\": 1 }\n" + |
| 201 |
|
| 202 |
"[0,0,0,0,0,0,0,0,1,1,0,2,2,2,0,3,3,3,0,0,4,4,4,0,5,5,5,0," + |
| 203 |
"6,6,6,0,0,0,0,0,0,0,0,0,7,7,7,7,0]\n" + |
| 204 |
|
| 205 |
"/** Begin file information. **/\n" + |
| 206 |
"[]\n" + |
| 207 |
|
| 208 |
"/** Begin mapping definitions. **/\n" + |
| 209 |
"[\"testcode\",1,0,\"f\"]\n" + |
| 210 |
"[\"testcode\",1,9,\"f\"]\n" + |
| 211 |
"[\"testcode\",1,11,\"foo\"]\n" + |
| 212 |
"[\"testcode\",1,16,\"bar\"]\n" + |
| 213 |
"[\"testcode\",1,23,\"foo\"]\n" + |
| 214 |
"[\"testcode\",1,29,\"foo\"]\n" + |
| 215 |
"[\"testcode\",1,35,\"bar\"]\n" + |
| 216 |
"[\"testcode\",1,51,\"foo\"]\n"); |
| 217 |
} |
| 218 |
|
| 219 |
public void testGoldenOutput2() throws Exception { |
| 220 |
checkSourceMap("function f(foo, bar) {\r\n\n\n\nfoo = foo + bar + foo;" + |
| 221 |
"\nreturn foo;\n}", |
| 222 |
|
| 223 |
"/** Begin line maps. **/{ \"file\" : \"testcode\", " + |
| 224 |
"\"count\": 1 }\n" + |
| 225 |
|
| 226 |
"[0,0,0,0,0,0,0,0,1,1,2,3,3,3,2,4,4,4,2,5,7,7,7,6,8,8,8," + |
| 227 |
"6,9,9,9,6,10,10,10,11,11,11,11,11,11,11,12,12,12," + |
| 228 |
"12,5]\n" + |
| 229 |
|
| 230 |
"/** Begin file information. **/\n" + |
| 231 |
"[]\n" + |
| 232 |
"/** Begin mapping definitions. **/\n" + |
| 233 |
"[\"testcode\",1,0,\"f\"]\n" + |
| 234 |
"[\"testcode\",1,9,\"f\"]\n" + |
| 235 |
"[\"testcode\",1,10]\n" + |
| 236 |
"[\"testcode\",1,11,\"foo\"]\n" + |
| 237 |
"[\"testcode\",1,16,\"bar\"]\n" + |
| 238 |
"[\"testcode\",1,21]\n" + |
| 239 |
"[\"testcode\",5,0]\n" + |
| 240 |
"[\"testcode\",5,0,\"foo\"]\n" + |
| 241 |
"[\"testcode\",5,6,\"foo\"]\n" + |
| 242 |
"[\"testcode\",5,12,\"bar\"]\n" + |
| 243 |
"[\"testcode\",5,18,\"foo\"]\n" + |
| 244 |
"[\"testcode\",6,0]\n" + |
| 245 |
"[\"testcode\",6,7,\"foo\"]\n"); |
| 246 |
} |
| 247 |
|
| 248 |
public void testGoldenOutput3() throws Exception { |
| 249 |
checkSourceMap("c:\\myfile.js", |
| 250 |
"foo;", |
| 251 |
|
| 252 |
"/** Begin line maps. **/{ \"file\" : \"testcode\", " + |
| 253 |
"\"count\": 1 }\n" + |
| 254 |
|
| 255 |
"[0,0,0]\n" + |
| 256 |
|
| 257 |
"/** Begin file information. **/\n" + |
| 258 |
"[]\n" + |
| 259 |
"/** Begin mapping definitions. **/\n" + |
| 260 |
"[\"c:\\\\myfile.js\",1,0,\"foo\"]\n"); |
| 261 |
} |
| 262 |
|
| 263 |
public void testGoldenOutput4() throws Exception { |
| 264 |
checkSourceMap("c:\\myfile.js", |
| 265 |
"foo; boo; goo;", |
| 266 |
|
| 267 |
"/** Begin line maps. **/" + |
| 268 |
"{ \"file\" : \"testcode\", \"count\": 1 }\n" + |
| 269 |
"[0,0,0,1,1,1,1,2,2,2,2]\n" + |
| 270 |
|
| 271 |
"/** Begin file information. **/\n" + |
| 272 |
"[]\n" + |
| 273 |
|
| 274 |
"/** Begin mapping definitions. **/\n" + |
| 275 |
"[\"c:\\\\myfile.js\",1,0,\"foo\"]\n" + |
| 276 |
"[\"c:\\\\myfile.js\",1,7,\"boo\"]\n" + |
| 277 |
"[\"c:\\\\myfile.js\",1,14,\"goo\"]\n"); |
| 278 |
} |
| 279 |
|
| 280 |
public void testGoldenOutput5() throws Exception { |
| 281 |
detailLevel = SourceMap.DetailLevel.ALL; |
| 282 |
|
| 283 |
checkSourceMap("c:\\myfile.js", |
| 284 |
"/** @preserve\n" + |
| 285 |
" * this is a test.\n" + |
| 286 |
" */\n" + |
| 287 |
"var foo=a + 'this is a really long line that will force the" |
| 288 |
+ " mapping to span multiple lines 123456789 123456789" |
| 289 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 290 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 291 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 292 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 293 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 294 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 295 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 296 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 297 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 298 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 299 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 300 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 301 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 302 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 303 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 304 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 305 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 306 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 307 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 308 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 309 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 310 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 311 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 312 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 313 |
+ "' + c + d + e;", |
| 314 |
|
| 315 |
"/** Begin line maps. **/" + |
| 316 |
"{ \"file\" : \"testcode\", \"count\": 6 }\n" + |
| 317 |
"[]\n" + |
| 318 |
"[]\n" + |
| 319 |
"[]\n" + |
| 320 |
"[]\n" + |
| 321 |
"[0,0,0,0,1,1,1,1,2,1,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 322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
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 354 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 355 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 356 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 357 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 358 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 359 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 360 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 361 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 362 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 363 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 364 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 365 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 366 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3," + |
| 367 |
"3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3]\n" + |
| 368 |
"[4,1,5,1,6]\n" + |
| 369 |
"/** Begin file information. **/\n" + |
| 370 |
"[]\n" + |
| 371 |
"[]\n" + |
| 372 |
"[]\n" + |
| 373 |
"[]\n" + |
| 374 |
"[]\n" + |
| 375 |
"[]\n" + |
| 376 |
"/** Begin mapping definitions. **/\n" + |
| 377 |
"[\"c:\\\\myfile.js\",4,0]\n" + |
| 378 |
"[\"c:\\\\myfile.js\",4,4,\"foo\"]\n" + |
| 379 |
"[\"c:\\\\myfile.js\",4,8,\"a\"]\n" + |
| 380 |
"[\"c:\\\\myfile.js\",4,12]\n" + |
| 381 |
"[\"c:\\\\myfile.js\",4,1314,\"c\"]\n" + |
| 382 |
"[\"c:\\\\myfile.js\",4,1318,\"d\"]\n" + |
| 383 |
"[\"c:\\\\myfile.js\",4,1322,\"e\"]\n"); |
| 384 |
|
| 385 |
detailLevel = SourceMap.DetailLevel.SYMBOLS; |
| 386 |
|
| 387 |
checkSourceMap("c:\\myfile.js", |
| 388 |
"/** @preserve\n" + |
| 389 |
" * this is a test.\n" + |
| 390 |
" */\n" + |
| 391 |
"var foo=a + 'this is a really long line that will force the" |
| 392 |
+ " mapping to span multiple lines 123456789 123456789" |
| 393 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 394 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 395 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 396 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 397 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 398 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 399 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 400 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 401 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 402 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 403 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 404 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 405 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 406 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 407 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 408 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 409 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 410 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 411 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 412 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 413 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 414 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 415 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 416 |
+ " 123456789 123456789 123456789 123456789 123456789" |
| 417 |
+ "' + c + d + e;", |
| 418 |
|
| 419 |
"/** Begin line maps. **/" + |
| 420 |
"{ \"file\" : \"testcode\", \"count\": 6 }\n" + |
| 421 |
"[]\n" + |
| 422 |
"[]\n" + |
| 423 |
"[]\n" + |
| 424 |
"[]\n" + |
| 425 |
"[-1,-1,-1,-1,0,0,0,0,1]\n" + |
| 426 |
"[2,0,3,0,4]\n" + |
| 427 |
"/** Begin file information. **/\n" + |
| 428 |
"[]\n" + |
| 429 |
"[]\n" + |
| 430 |
"[]\n" + |
| 431 |
"[]\n" + |
| 432 |
"[]\n" + |
| 433 |
"[]\n" + |
| 434 |
"/** Begin mapping definitions. **/\n" + |
| 435 |
"[\"c:\\\\myfile.js\",4,4,\"foo\"]\n" + |
| 436 |
"[\"c:\\\\myfile.js\",4,8,\"a\"]\n" + |
| 437 |
"[\"c:\\\\myfile.js\",4,1314,\"c\"]\n" + |
| 438 |
"[\"c:\\\\myfile.js\",4,1318,\"d\"]\n" + |
| 439 |
"[\"c:\\\\myfile.js\",4,1322,\"e\"]\n"); |
| 440 |
} |
| 441 |
|
| 442 |
public void testBasicDeterminism() throws Exception { |
| 443 |
RunResult result1 = compile("file1", "foo;", "file2", "bar;"); |
| 444 |
RunResult result2 = compile("file2", "foo;", "file1", "bar;"); |
| 445 |
|
| 446 |
String map1 = getSourceMap(result1); |
| 447 |
String map2 = getSourceMap(result2); |
| 448 |
|
| 449 |
|
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
String files1 = map1.split("\n")[4]; |
| 454 |
String files2 = map2.split("\n")[4]; |
| 455 |
|
| 456 |
assertEquals(files1, files2); |
| 457 |
} |
| 458 |
} |