tests: Add test for SWF4 string ops

This commit is contained in:
Mike Welsh 2020-09-16 00:51:09 -07:00
parent 7eeba10bef
commit 6f2655cf95
4 changed files with 96 additions and 0 deletions

View File

@ -160,6 +160,7 @@ swf_tests! {
(slash_syntax, "avm1/slash_syntax", 2), (slash_syntax, "avm1/slash_syntax", 2),
(strictequals_swf6, "avm1/strictequals_swf6", 1), (strictequals_swf6, "avm1/strictequals_swf6", 1),
(string_methods, "avm1/string_methods", 1), (string_methods, "avm1/string_methods", 1),
(string_ops_swf6, "avm1/string_ops_swf6", 1),
(path_string, "avm1/path_string", 1), (path_string, "avm1/path_string", 1),
(global_is_bare, "avm1/global_is_bare", 1), (global_is_bare, "avm1/global_is_bare", 1),
(primitive_type_globals, "avm1/primitive_type_globals", 1), (primitive_type_globals, "avm1/primitive_type_globals", 1),

View File

@ -0,0 +1,95 @@
// length
// length("foo")
3
// mblength()
3
// length("")
0
// mblength("")
0
// length("😋")
2
// mblength("😋")
2
// length("😋Спасибо𝌆𝌆hello")
18
// mblength("😋Спасибо𝌆𝌆hello")
18
// ord("f")
102
// mbord("f")
102
// ord("bar")
98
// mbord("bar")
98
// ord(null)
110
// mbord(null)
110
// ord("愛")
24859
// mbord("愛")
24859
// ord("😋")
65533
// mbord("😋")
65533
// chr(80)
P
// mbchr(80)
P
// chr(12345)
// chr(12345)
// chr(65616)
P
// mbchr(65616)
P
// chr(-65456)
P
// mbchr(-65456)
P
// chr(0xd801)
<EFBFBD>
// mbchr(0xd801)
<EFBFBD>
// chr(0xabababab)
// mbchr(0xabababab)
// chr(null)
// mbchr(null)
// chr(true)

// mbchr(true)

// substring(s, 1, 2)
😋
// mbsubstring(s, 1, 2)
😋
// substring(s, 3, 1)
// mbsubstring(s, 3, 1)
// substring(s, 0, 2)
😋
// mbsubstring(s, 0, 2)
😋
// substring(s, -5, -100)
😋航空母艦testing!
// mbsubstring(s, -5, -100)
😋航空母艦testing!
// substring(s, 2, 0)
// mbsubstring(s, 2, 0)
// substring(s, 4294967303, -4294967294)
te
// mbsubstring(s, 4294967303, -4294967294)
te

Binary file not shown.

Binary file not shown.