mirror of
https://github.com/lightbend/config.git
synced 2025-02-19 07:40:31 +08:00
add some tests for paths with hyphen and underscore in them
This commit is contained in:
parent
d13f7861fd
commit
a722d5249e
@ -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
|
||||
}
|
||||
|
@ -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("-")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user