aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/com/google/devtools/build/lib/syntax/LexerTest.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/syntax/LexerTest.java b/src/test/java/com/google/devtools/build/lib/syntax/LexerTest.java
index 45e66bf060..31ec265f85 100644
--- a/src/test/java/com/google/devtools/build/lib/syntax/LexerTest.java
+++ b/src/test/java/com/google/devtools/build/lib/syntax/LexerTest.java
@@ -169,6 +169,13 @@ public class LexerTest {
}
@Test
+ public void testCrLf() throws Exception {
+ assertEquals("NEWLINE EOF", names(tokens("\r\n\r\n")));
+ assertEquals("NEWLINE INT NEWLINE EOF", names(tokens("\r\n\r1\r\r\n")));
+ assertEquals("COMMENT NEWLINE COMMENT NEWLINE EOF", names(tokens("# foo\r\n# bar\r\n")));
+ }
+
+ @Test
public void testIntegers() throws Exception {
// Detection of MINUS immediately following integer constant proves we
// don't consume too many chars.
@@ -338,6 +345,20 @@ public class LexerTest {
}
@Test
+ public void testIndentationWithCrLf() throws Exception {
+ assertEquals("INT(1) NEWLINE INDENT INT(2) NEWLINE OUTDENT NEWLINE EOF",
+ values(tokens("1\r\n 2\r\n")));
+ assertEquals("INT(1) NEWLINE INDENT INT(2) NEWLINE OUTDENT NEWLINE EOF",
+ values(tokens("1\r\n 2\r\n\r\n")));
+ assertEquals("INT(1) NEWLINE INDENT INT(2) NEWLINE INDENT INT(3) NEWLINE OUTDENT INT(4) "
+ + "NEWLINE OUTDENT INT(5) NEWLINE EOF",
+ values(tokens("1\r\n 2\r\n 3\r\n 4\r\n5")));
+ assertEquals(
+ "INT(1) NEWLINE INDENT INT(2) NEWLINE INT(3) NEWLINE OUTDENT INT(4) NEWLINE EOF",
+ values(tokens("1\r\n 2\r\n\r\n 3\r\n4")));
+ }
+
+ @Test
public void testIndentationInsideParens() throws Exception {
// Indentation is ignored inside parens:
assertEquals("INT(1) LPAREN INT(2) INT(3) INT(4) INT(5) NEWLINE EOF",