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

toml: fix scanning of short unicode escapes (#12491)

This commit is contained in:
Larpon
2021-11-17 16:24:40 +01:00
committed by GitHub
parent 3e1fb22a04
commit 7cdc906683
2 changed files with 12 additions and 1 deletions

View File

@@ -28,6 +28,8 @@ two
three
four
'''"
toml_unicode_escapes = r'short = "\u03B4"
long = "\U000003B4"'
)
fn test_multiline_strings() {
@@ -66,6 +68,15 @@ fn test_multiline_strings() {
assert value.string() == 'aaa' + '"""' + 'bbb'
}
fn test_unicode_escapes() {
mut toml_doc := toml.parse(toml_unicode_escapes) or { panic(err) }
mut value := toml_doc.value('short')
assert value.string() == r'\u03B4'
value = toml_doc.value('long')
assert value.string() == r'\U000003B4'
}
fn test_literal_strings() {
toml_file :=
os.real_path(os.join_path(os.dir(@FILE), 'testdata', os.file_name(@FILE).all_before_last('.'))) +