@@ -18,16 +18,16 @@ public PathTests(ITestOutputHelper output)
18
18
}
19
19
20
20
[ Theory ]
21
- [ InlineData ( new string [ ] { "foo" , "bar" } , "foo.bar" ) ]
22
- [ InlineData ( new string [ ] { "foo" , "bar.baz" } , "foo.\" bar.baz\" " ) ]
23
- [ InlineData ( new string [ ] { "shoot" , "a \" laser\" beam" } , "shoot.\" a \\ \" laser\\ \" beam\" " ) ]
24
- [ InlineData ( new string [ ] { "foo" , "bar\n baz" } , "foo.\" bar\\ nbaz\" " ) ]
25
- [ InlineData ( new string [ ] { "foo" , "bar baz" , " wis " } , "foo.bar baz. wis " ) ]
26
- [ InlineData ( new string [ ] { "foo" , "bar\t baz" } , "foo.bar\t baz" ) ]
27
- [ InlineData ( new string [ ] { "foo" , "bar\r \n baz" , "x\r " } , "foo.\" bar\r \\ nbaz\" .x\r " ) ]
28
- [ InlineData ( new string [ ] { "foo" , "" } , "foo.\" \" " ) ]
29
- [ InlineData ( new string [ ] { "foo" , "\\ " } , "foo.\" \\ \\ \" " ) ]
30
- [ InlineData ( new string [ ] { "$\" {}[]:=,#`^?!@*&\\ " } , "\" " + "$\\ \" {}[]:=,#`^?!@*&\\ \\ " + "\" " ) ]
21
+ [ InlineData ( new [ ] { "foo" , "bar" } , "foo.bar" ) ]
22
+ [ InlineData ( new [ ] { "foo" , "bar.baz" } , "foo.\" bar.baz\" " ) ]
23
+ [ InlineData ( new [ ] { "shoot" , "a \" laser\" beam" } , "shoot.\" a \\ \" laser\\ \" beam\" " ) ]
24
+ [ InlineData ( new [ ] { "foo" , "bar\n baz" } , "foo.\" bar\\ nbaz\" " ) ]
25
+ [ InlineData ( new [ ] { "foo" , "bar baz" , " wis " } , "foo.bar baz. wis " ) ]
26
+ [ InlineData ( new [ ] { "foo" , "bar\t baz" } , "foo.bar\t baz" ) ]
27
+ [ InlineData ( new [ ] { "foo" , "bar\r \n baz" , "x\r " } , "foo.\" bar\r \\ nbaz\" .x\r " ) ]
28
+ [ InlineData ( new [ ] { "foo" , "" } , "foo.\" \" " ) ]
29
+ [ InlineData ( new [ ] { "foo" , "\\ " } , "foo.\" \\ \\ \" " ) ]
30
+ [ InlineData ( new [ ] { "$\" {}[]:=,#`^?!@*&\\ " } , "\" " + "$\\ \" {}[]:=,#`^?!@*&\\ \\ " + "\" " ) ]
31
31
public void CanParseAndSerialize ( string [ ] pathKeys , string path )
32
32
{
33
33
HoconPath hoconPath = new HoconPath ( pathKeys ) ;
@@ -47,19 +47,51 @@ public void CanParseAndSerialize(string[] pathKeys, string path)
47
47
Assert . Equal ( pathKeys [ i ] , hoconPath2 [ i ] ) ;
48
48
}
49
49
50
- _output . WriteLine ( string . Format ( "Path [{0}] serialized from: {1}" , path , string . Join ( ", " , pathKeys ) ) ) ;
50
+ _output . WriteLine ( $ "Path [{ path } ] serialized from: { string . Join ( ", " , pathKeys ) } ") ;
51
+ }
52
+
53
+ // Test that #79 invalid token exception does not happen.
54
+ [ Fact ]
55
+ public void DotAndCommaInQuotedKeyShouldBePreserved_79 ( )
56
+ {
57
+ const string hocon = @"
58
+ akka {
59
+ persistence {
60
+ journal {
61
+ plugin = ""akka.persistence.journal.sql - server""
62
+ sql-server {
63
+ class = ""Akka.Persistence.SqlServer.Journal.BatchingSqlServerJournal, Akka.Persistence.SqlServer""
64
+ schema-name = dbo
65
+ table-name = EventJournal
66
+ auto-initialize = off
67
+ event-adapters
68
+ {
69
+ json-adapter = ""Demo.EventAdapter, Demo""
70
+ }
71
+ event-adapter-bindings
72
+ {
73
+ ""Demo.IMyEvent, MyDemoAssembly"" = json-adapter #this line makes a invalid token exception
74
+ }
75
+ }
76
+ }
77
+ }
78
+ }" ;
79
+ var config = Parser . Parse ( hocon ) ;
80
+ var path = HoconPath . Parse ( "akka.persistence.journal.sql-server.event-adapter-bindings.\" Demo.IMyEvent, MyDemoAssembly\" " ) ;
81
+ Assert . Equal ( "Demo.IMyEvent, MyDemoAssembly" , path . Last ( ) ) ;
82
+ Assert . Equal ( "json-adapter" , config . GetString ( path ) ) ;
51
83
}
52
84
53
85
[ Fact ]
54
86
public void PathToStringQuoteKeysContainingDot ( )
55
87
{
56
- var path1 = new HoconPath ( new string [ ] {
88
+ var path1 = new HoconPath ( new [ ] {
57
89
"i am" ,
58
90
"kong.fu" ,
59
91
"panda"
60
92
} ) ;
61
93
62
- var path2 = new HoconPath ( new string [ ]
94
+ var path2 = new HoconPath ( new [ ]
63
95
{
64
96
"i am" ,
65
97
"kong" ,
0 commit comments