| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
package com.google.javascript.jscomp; |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
public class ObjectPropertyStringPostprocessTest extends CompilerTestCase { |
| 25 |
@Override |
| 26 |
protected CompilerPass getProcessor(final Compiler compiler) { |
| 27 |
return new ObjectPropertyStringPostprocess(compiler); |
| 28 |
} |
| 29 |
|
| 30 |
@Override |
| 31 |
protected int getNumRepetitions() { |
| 32 |
return 1; |
| 33 |
} |
| 34 |
|
| 35 |
public void testFooDotBar() { |
| 36 |
testPass("goog.global, foo.bar", "foo, 'bar'"); |
| 37 |
} |
| 38 |
|
| 39 |
public void testFooGetElemBar() { |
| 40 |
testPass("goog.global, foo[bar]", "foo, bar"); |
| 41 |
} |
| 42 |
|
| 43 |
public void testFooBar() { |
| 44 |
testPass("goog.global, foo$bar", "goog.global, 'foo$bar'"); |
| 45 |
} |
| 46 |
|
| 47 |
private void testPass(String input, String expected) { |
| 48 |
test("new JSCompiler_ObjectPropertyString(" + input + ")", |
| 49 |
"new JSCompiler_ObjectPropertyString(" + expected + ")"); |
| 50 |
} |
| 51 |
} |