aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShevek <[email protected]>2013-11-04 16:20:44 -0800
committerShevek <[email protected]>2013-11-04 16:20:44 -0800
commit39264fd6d2a6646e49f83b5b2b3512c1663a1c9b (patch)
treedcfdf1b49246f6d33fd79083aae9b1d9a3b079f9
parentc18cabd5c52ac75fedc73e29edb702c451ccc8e8 (diff)
LexerSourceTestCase: Check token offsets to detect bug spotted in jnaerator edition.
-rw-r--r--src/tests/org/anarres/cpp/LexerSourceTestCase.java3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/tests/org/anarres/cpp/LexerSourceTestCase.java b/src/tests/org/anarres/cpp/LexerSourceTestCase.java
index ac3f61f..d554814 100644
--- a/src/tests/org/anarres/cpp/LexerSourceTestCase.java
+++ b/src/tests/org/anarres/cpp/LexerSourceTestCase.java
@@ -18,10 +18,13 @@ public class LexerSourceTestCase extends BaseTestCase implements Test {
Arrays.toString(out));
StringLexerSource s = new StringLexerSource(in);
+ int col = 0;
for (int i = 0; i < out.length; i++) {
Token tok = s.token();
System.out.println("Token is " + tok);
assertEquals(out[i], tok.getType());
+ assertEquals(col, tok.getColumn());
+ col += tok.getText().length();
}
assertEquals(EOF, s.token().getType());
}