mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-08 14:18:26 +02:00
add tests for go config parser
This commit is contained in:
@@ -47,6 +47,24 @@ func TestSSHConfigParsing(t *testing.T) {
|
|||||||
rt()
|
rt()
|
||||||
conf = "env a=b"
|
conf = "env a=b"
|
||||||
rt(`export 'a'="b"`)
|
rt(`export 'a'="b"`)
|
||||||
|
|
||||||
|
conf = "env a=\\"
|
||||||
|
rt(`export 'a'="\\"`)
|
||||||
|
conf = `env
|
||||||
|
\ a=
|
||||||
|
\\`
|
||||||
|
conf = "env\n \t \\ a=\n\\\\"
|
||||||
|
rt(`export 'a'="\\"`)
|
||||||
|
conf = `
|
||||||
|
e
|
||||||
|
\n
|
||||||
|
\v
|
||||||
|
\ a
|
||||||
|
\=
|
||||||
|
\\
|
||||||
|
\`
|
||||||
|
rt(`export 'a'="\\"`)
|
||||||
|
|
||||||
conf = "env a=b\nhostname 2\nenv a=c\nenv b=b"
|
conf = "env a=b\nhostname 2\nenv a=c\nenv b=b"
|
||||||
rt(`export 'a'="b"`)
|
rt(`export 'a'="b"`)
|
||||||
hostname = "2"
|
hostname = "2"
|
||||||
|
|||||||
@@ -19,13 +19,18 @@ func TestConfigParsing(t *testing.T) {
|
|||||||
os.Mkdir(filepath.Join(tdir, "sub"), 0o700)
|
os.Mkdir(filepath.Join(tdir, "sub"), 0o700)
|
||||||
os.WriteFile(conf_file, []byte(
|
os.WriteFile(conf_file, []byte(
|
||||||
`error main
|
`error main
|
||||||
# ignore me
|
# igno
|
||||||
|
\re me
|
||||||
a one
|
a one
|
||||||
#: other
|
#: other
|
||||||
include sub/b.conf
|
include
|
||||||
|
\ sub/b.conf
|
||||||
b
|
b
|
||||||
include non-existent
|
include non-exis
|
||||||
globinclude sub/c?.conf
|
\tent
|
||||||
|
globin
|
||||||
|
\clude sub/c?.c
|
||||||
|
\onf
|
||||||
`), 0o600)
|
`), 0o600)
|
||||||
os.WriteFile(filepath.Join(tdir, "sub/b.conf"), []byte("incb cool\ninclude a.conf"), 0o600)
|
os.WriteFile(filepath.Join(tdir, "sub/b.conf"), []byte("incb cool\ninclude a.conf"), 0o600)
|
||||||
os.WriteFile(filepath.Join(tdir, "sub/c1.conf"), []byte("inc1 cool"), 0o600)
|
os.WriteFile(filepath.Join(tdir, "sub/c1.conf"), []byte("inc1 cool"), 0o600)
|
||||||
|
|||||||
Reference in New Issue
Block a user