| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package org.mozilla.javascript.tests; |
| 6 |
|
| 7 |
|
| 8 |
import org.junit.Assert; |
| 9 |
import org.junit.Test; |
| 10 |
import org.mozilla.javascript.Context; |
| 11 |
import org.mozilla.javascript.ContextAction; |
| 12 |
import org.mozilla.javascript.Script; |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
public class DecompileTest { |
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
@Test |
| 25 |
public void newObject0Arg() |
| 26 |
{ |
| 27 |
final String source = "var x = new Date().getTime();"; |
| 28 |
final ContextAction action = new ContextAction() { |
| 29 |
public Object run(final Context cx) { |
| 30 |
final Script script = cx.compileString(source, "my script", 0, null); |
| 31 |
Assert.assertEquals(source, cx.decompileScript(script, 4).trim()); |
| 32 |
return null; |
| 33 |
} |
| 34 |
}; |
| 35 |
Utils.runWithAllOptimizationLevels(action); |
| 36 |
} |
| 37 |
} |