add some tests for paths with hyphen and underscore in them

This commit is contained in:
Havoc Pennington 2011-11-10 20:52:06 -05:00
parent d13f7861fd
commit a722d5249e
2 changed files with 13 additions and 2 deletions

View File

@ -7,5 +7,8 @@
"57_a" : ${a.b.c},
"57_b" : ${"a"."b"."c"},
"a.b.c" : 103,
"103_a" : ${"a.b.c"}
"103_a" : ${"a.b.c"},
"a-c" : 259,
"a_c" : 260,
"-" : 261
}

View File

@ -65,7 +65,7 @@ class ConfParserTest extends TestUtils {
}
// also parse with the standalone path parser and be sure the
// outcome is the same
// outcome is the same.
val shouldBeSame = Parser.parsePath(s)
assertEquals(result, shouldBeSame)
@ -95,6 +95,9 @@ class ConfParserTest extends TestUtils {
assertEquals(path("a", ""), parsePath("a.\"\"\"\""))
assertEquals(path("", "b"), parsePath("\"\"\"\".b"))
assertEquals(path("", "", ""), parsePath(""" "".""."" """))
assertEquals(path("a-c"), parsePath("a-c"))
assertEquals(path("a_c"), parsePath("a_c"))
assertEquals(path("-"), parsePath("\"-\""))
for (invalid <- Seq("a.", ".b", "a..b", "a${b}c", "\"\".", ".\"\"")) {
try {
@ -107,5 +110,10 @@ class ConfParserTest extends TestUtils {
throw e;
}
}
intercept[ConfigException.Parse] {
// this gets parsed as a number since it starts with '-'
parsePath("-")
}
}
}