Add support for more option types to Go conf file parsing

This commit is contained in:
Kovid Goyal
2023-03-15 15:17:38 +05:30
parent 3803d7e3c2
commit da38cb3254
3 changed files with 245 additions and 4 deletions

View File

@@ -0,0 +1,26 @@
// License: GPLv3 Copyright: 2023, Kovid Goyal, <kovid at kovidgoyal.net>
package config
import (
"fmt"
"testing"
)
var _ = fmt.Print
func TestStringLiteralParsing(t *testing.T) {
for q, expected := range map[string]string{
`abc`: `abc`,
`a\nb\M`: "a\nb\\M",
`a\x20\x1\u1234\123\12|`: "a \\x1\u1234\123\x0a|",
} {
actual, err := StringLiteral(q)
if err != nil {
t.Fatal(err)
}
if expected != actual {
t.Fatalf("Failed with input: %#v\n%#v != %#v", q, expected, actual)
}
}
}