Skip to content

Commit

Permalink
Merge pull request #3453 from onflow/bastian/more-string-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
turbolent authored Jul 8, 2024
2 parents 5979bf0 + c952163 commit 76eeaf2
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions runtime/tests/interpreter/interpreter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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(
Expand All @@ -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) {
Expand Down

0 comments on commit 76eeaf2

Please sign in to comment.