From 1f4a07adab66a86b9c35102c27f65ac6247fd23e Mon Sep 17 00:00:00 2001 From: Martin Tournoij Date: Wed, 15 May 2024 11:44:36 +0100 Subject: [PATCH] Test if fist character in string is multibyte --- tests/valid/string/start-mb.json | 9 +++++++++ tests/valid/string/start-mb.toml | 13 +++++++++++++ toml_test.go | 4 ++-- 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 tests/valid/string/start-mb.json create mode 100644 tests/valid/string/start-mb.toml diff --git a/tests/valid/string/start-mb.json b/tests/valid/string/start-mb.json new file mode 100644 index 0000000..523dacc --- /dev/null +++ b/tests/valid/string/start-mb.json @@ -0,0 +1,9 @@ +{ + "s1": {"type": "string", "value": "§"}, + "s2": {"type": "string", "value": "§"}, + "s3": {"type": "string", "value": "§"}, + "s4": {"type": "string", "value": "§"}, + "s5": {"type": "string", "value": "§"}, + "s6": {"type": "string", "value": "§"}, + "s7": {"type": "string", "value": "§"} +} diff --git a/tests/valid/string/start-mb.toml b/tests/valid/string/start-mb.toml new file mode 100644 index 0000000..2576f1b --- /dev/null +++ b/tests/valid/string/start-mb.toml @@ -0,0 +1,13 @@ +# Start first line with a multibyte character. +# +# https://github.com/marzer/tomlplusplus/issues/190 +s1 = "§" +s2 = '§' +s3 = """\ +§""" +s4 = """ +§""" +s5 = """§""" +s6 = ''' +§''' +s7 = '''§''' diff --git a/toml_test.go b/toml_test.go index 9aa6fa8..5331638 100644 --- a/toml_test.go +++ b/toml_test.go @@ -138,8 +138,8 @@ func TestSize(t *testing.T) { return nil } - if inf.Size() > 1024 { - t.Errorf("larger than 1K: %s (%fK)", path, float64(inf.Size())/1024) + if inf.Size() > 2048 { + t.Errorf("larger than 2K: %s (%fK)", path, float64(inf.Size())/1024) } return nil })