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:
@@ -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('.'))) +
|
||||
|
||||
Reference in New Issue
Block a user