1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

toml: ignore CRLF just like LF in line comments, support VTEST_HIDE_OK=1 in tests.

This commit is contained in:
Delyan Angelov
2022-01-02 18:13:43 +02:00
parent b4111451bf
commit ee858568ff
7 changed files with 242 additions and 180 deletions

View File

@ -11,3 +11,13 @@ fn test_crlf() {
assert value as string == str_value
assert value.string() == str_value
}
fn test_crlf_is_parsable_just_like_lf() ? {
crlf_content := '# a comment\r\ntitle = "TOML Example"\r\n[database]\r\nserver = "192.168.1.1"\r\nports = [ 8000, 8001, 8002 ]\r\n'
all := [crlf_content, crlf_content.replace('\r\n', '\n')]
for content in all {
res := toml.parse(content) ?
assert res.value('title') == toml.Any('TOML Example')
assert (res.value('database') as map[string]toml.Any)['server'] ? == toml.Any('192.168.1.1')
}
}