From c952163d873791ac533404fe0f5d438e2d14e40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20M=C3=BCller?= Date: Mon, 8 Jul 2024 10:51:19 -0700 Subject: [PATCH] add some more tests for string functions --- runtime/tests/interpreter/interpreter_test.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/runtime/tests/interpreter/interpreter_test.go b/runtime/tests/interpreter/interpreter_test.go index 51630906ce..5e014f5c67 100644 --- a/runtime/tests/interpreter/interpreter_test.go +++ b/runtime/tests/interpreter/interpreter_test.go @@ -1125,6 +1125,8 @@ func TestInterpretStringSlicing(t *testing.T) { {"cafe\\u{301}ba\\u{308}be", 4, 8, "ba\u0308be", nil}, {"cafe\\u{301}ba\\u{308}be", 3, 4, "e\u0301", nil}, {"cafe\\u{301}ba\\u{308}be", 5, 6, "a\u0308", nil}, + {"tamil \\u{BA8}\\u{BBF} (ni)", 0, 7, "tamil \u0BA8\u0BBF", nil}, + {"tamil \\u{BA8}\\u{BBF} (ni)", 7, 12, " (ni)", nil}, } runTest := func(test test) { @@ -5355,6 +5357,7 @@ func TestInterpretStringLength(t *testing.T) { inter := parseCheckAndInterpret(t, ` let x = "cafe\u{301}".length let y = x + let z = "\u{1F3F3}\u{FE0F}\u{200D}\u{1F308}".length `) AssertValuesEqual( @@ -5369,6 +5372,12 @@ func TestInterpretStringLength(t *testing.T) { interpreter.NewUnmeteredIntValueFromInt64(4), inter.Globals.Get("y").GetValue(inter), ) + AssertValuesEqual( + t, + inter, + interpreter.NewUnmeteredIntValueFromInt64(1), + inter.Globals.Get("z").GetValue(inter), + ) } func TestInterpretStructureFunctionBindingInside(t *testing.T) {