Properly decode \\n
This commit is contained in:
parent
ab2c4c3120
commit
88ef419bd9
@ -47,7 +47,7 @@ func TestDecode_interface(t *testing.T) {
|
|||||||
"escape.hcl",
|
"escape.hcl",
|
||||||
false,
|
false,
|
||||||
map[string]interface{}{
|
map[string]interface{}{
|
||||||
"foo": "bar\"baz",
|
"foo": "bar\"baz\\n",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -196,7 +196,7 @@ func TestDecode_interface(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if !reflect.DeepEqual(out, tc.Out) {
|
if !reflect.DeepEqual(out, tc.Out) {
|
||||||
t.Fatalf("Input: %s\n\n%#v\n\n%#v", tc.File, out, tc.Out)
|
t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", tc.File, out, tc.Out)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -365,6 +365,8 @@ func (x *hclLex) lexString(yylval *hclSymType) int {
|
|||||||
c = n
|
c = n
|
||||||
case 'n':
|
case 'n':
|
||||||
c = '\n'
|
c = '\n'
|
||||||
|
case '\\':
|
||||||
|
c = n
|
||||||
default:
|
default:
|
||||||
x.backup()
|
x.backup()
|
||||||
}
|
}
|
||||||
|
@ -133,6 +133,8 @@ func (x *jsonLex) lexString(yylval *jsonSymType) int {
|
|||||||
c = n
|
c = n
|
||||||
case 'n':
|
case 'n':
|
||||||
c = '\n'
|
c = '\n'
|
||||||
|
case '\\':
|
||||||
|
c = n
|
||||||
default:
|
default:
|
||||||
x.backup()
|
x.backup()
|
||||||
}
|
}
|
||||||
|
@ -1 +1 @@
|
|||||||
foo = "bar\"baz"
|
foo = "bar\"baz\\n"
|
||||||
|
Loading…
Reference in New Issue
Block a user