| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package org.mozilla.javascript.tests; |
| 6 |
|
| 7 |
import org.junit.Before; |
| 8 |
import org.junit.Test; |
| 9 |
import org.mozilla.javascript.CompilerEnvirons; |
| 10 |
import org.mozilla.javascript.Parser; |
| 11 |
import org.mozilla.javascript.ast.AstRoot; |
| 12 |
|
| 13 |
import java.io.IOException; |
| 14 |
import java.io.StringReader; |
| 15 |
|
| 16 |
import static junit.framework.Assert.assertEquals; |
| 17 |
|
| 18 |
public class BugGetterSetterTest { |
| 19 |
private CompilerEnvirons environment = new CompilerEnvirons(); |
| 20 |
|
| 21 |
@Before |
| 22 |
public void setUp() throws Exception { |
| 23 |
environment.setLanguageVersion(180); |
| 24 |
environment.setStrictMode(false); |
| 25 |
} |
| 26 |
|
| 27 |
@Test |
| 28 |
public void testNodeReplacementInWhileLoopWithBrackets() throws IOException { |
| 29 |
String script = "var o = {\n" + |
| 30 |
" _x: 123, \n" + |
| 31 |
" get x() {\n" + |
| 32 |
" return this._x;\n" + |
| 33 |
" }\n" + |
| 34 |
", \n" + |
| 35 |
" set x(value) {\n" + |
| 36 |
" this._x = value;\n" + |
| 37 |
" }\n" + |
| 38 |
"};\n"; |
| 39 |
|
| 40 |
Parser parser = new Parser(environment); |
| 41 |
AstRoot astRoot = parser.parse(new StringReader(script), null, 1); |
| 42 |
assertEquals(script, astRoot.toSource()); |
| 43 |
} |
| 44 |
} |