summaryrefslogtreecommitdiffstats
path: root/configgen
diff options
context:
space:
mode:
authorgjoranv <gv@oath.com>2017-08-16 13:32:27 +0200
committergjoranv <gv@oath.com>2017-08-16 13:32:27 +0200
commit4ec1ad14fcd03b3fb1aec654dddb8ae0e55785d0 (patch)
tree2e902b3fb984900714b2ef37d65a3fe8c7f93967 /configgen
parent875e2dcd783d6371ed1e4d5a289802763026786c (diff)
Split "number in namespace" tests to clarify intention.
Diffstat (limited to 'configgen')
-rw-r--r--configgen/src/test/java/com/yahoo/config/codegen/DefParserTest.java29
1 files changed, 18 insertions, 11 deletions
diff --git a/configgen/src/test/java/com/yahoo/config/codegen/DefParserTest.java b/configgen/src/test/java/com/yahoo/config/codegen/DefParserTest.java
index 148b654f4e5..2260690155c 100644
--- a/configgen/src/test/java/com/yahoo/config/codegen/DefParserTest.java
+++ b/configgen/src/test/java/com/yahoo/config/codegen/DefParserTest.java
@@ -459,35 +459,42 @@ public class DefParserTest {
}
@Test
- public void testNumberInNamespace() throws IOException, DefParser.DefParserException {
+ public void number_is_allowed_as_non_leading_char_in_namespace() throws IOException, DefParser.DefParserException {
StringBuilder sb = createDefTemplate();
String line = "namespace=a.b.c2\nfoo int\n";
sb.append(line);
createParser(sb.toString()).parse();
+ }
- sb = createDefTemplate();
- line = "namespace=2.a.b\n";
- sb.append(line);
- Class<?> exceptionClass = DefParser.DefParserException.class;
+ @Test
+ public void number_is_not_allowed_as_namespace_start_char() throws IOException, DefParser.DefParserException {
+ StringBuilder sb = createDefTemplate();
+ String line = "namespace=2.a.b";
+ sb.append(line).append("\n");
+ Class<?> exceptionClass = DefParser.DefParserException.class;
try {
createParser(sb.toString()).parse();
fail("Didn't find expected exception of type " + exceptionClass);
} catch (Exception e) {
assertExceptionAndMessage(e, exceptionClass,
- "Error when parsing line 3: " + line + "namespace=2.a.b");
+ "Error when parsing line 3: " + line + "\n" + line);
}
+ }
- sb = createDefTemplate();
- line = "namespace=a.b.2c\n";
- sb.append(line);
- exceptionClass = DefParser.DefParserException.class;
+ @Test
+ public void number_is_not_allowed_as_leading_char_in_namespace_token() throws IOException, DefParser.DefParserException {
+ StringBuilder sb = createDefTemplate();
+ String line = "namespace=a.b.2c";
+ sb.append(line).append("\n");
+ Class<?> exceptionClass = DefParser.DefParserException.class;
try {
createParser(sb.toString()).parse();
fail("Didn't find expected exception of type " + exceptionClass);
} catch (Exception e) {
assertExceptionAndMessage(e, exceptionClass,
- "Error when parsing line 3: " + line + "namespace=a.b.2c");
+ "Error when parsing line 3: " + line + "\n" + line);
}
+
}
@Test