diff options
| author | Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com> | 2026-09-27 23:57:11 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-09-27 08:57:11 -0700 |
| commit | 5f85f435aeece40e2c0770f89d7642f9af718531 (patch) | |
| tree | 05308ec28431fff7d6e478146a7ac48f96d88911 /chapter03/src | |
| parent | 837b6ae9cc19efb569f69422f6b82034b61e8ffe (diff) | |
| download | Simple-5f85f435aeece40e2c0770f89d7642f9af718531.tar.gz Simple-5f85f435aeece40e2c0770f89d7642f9af718531.zip | |
Remove excessive spaces in test code (#256)
Co-authored-by: Cliff Click <cliffc@acm.org>
Diffstat (limited to 'chapter03/src')
| -rw-r--r-- | chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java b/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java index 78696633..c7de06df 100644 --- a/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java +++ b/chapter03/src/test/java/com/seaofnodes/simple/Chapter03Test.java @@ -29,8 +29,17 @@ public class Chapter03Test { } @Test + public void testVarScopeNoPeephole() { + Parser parser = new Parser("int a=1; int b=2; int c=0; { int b=3; c=a+b; } return c;"); + Node._disablePeephole = true; + ReturnNode ret = parser.parse(); + Node._disablePeephole = false; + assertEquals("return (1+3);", ret.print()); + } + + @Test public void testVarDist() { - Parser parser = new Parser("int x0=1; int y0=2; int x1=3; int y1=4; return (x0-x1)*(x0-x1) + (y0-y1)*(y0-y1); "); + Parser parser = new Parser("int x0=1; int y0=2; int x1=3; int y1=4; return (x0-x1)*(x0-x1) + (y0-y1)*(y0-y1);"); ReturnNode ret = parser.parse(); assertEquals("return 8;", ret.print()); } |
