chore: remove entire VM test suite and update test README for CLI-only focus

Delete all VM-related test files including benchmark, call, error, foreign_class, and other API tests, along with their C source, headers, and Wren scripts. Rewrite test/README.md to describe only CLI unit tests and module resolution tests, removing references to VM, compiler, core library, and language semantics tests.
This commit is contained in:
underscorediscovery
2020-02-12 04:16:03 +00:00
parent 8c2d35cfea
commit ce0106ad7e
913 changed files with 3 additions and 281169 deletions
-6
View File
@@ -1,6 +0,0 @@
// Bytes: 11111
// 012345678901234
// Chars: sø mé ஃ thî ng
var s = "søméஃthîng"
System.print(s.bytes is StringByteSequence) // expect: true
-4
View File
@@ -1,4 +0,0 @@
System.print("a" + "b") // expect: ab
// 8-bit clean.
System.print(("a\0b" + "\0c") == "a\0b\0c") // expect: true
@@ -1 +0,0 @@
System.print("a" + 123) // expect runtime error: Right operand must be a string.
-16
View File
@@ -1,16 +0,0 @@
System.print("".contains("")) // expect: true
System.print("anything".contains("")) // expect: true
System.print("something".contains("meth")) // expect: true
System.print("something".contains("some")) // expect: true
System.print("something".contains("ing")) // expect: true
System.print("something".contains("math")) // expect: false
// Non-ASCII.
System.print("søméthîng".contains("méth")) // expect: true
System.print("søméthîng".contains("meth")) // expect: false
// 8-bit clean.
System.print("a\0b\0c".contains("\0")) // expect: true
System.print("a\0b\0c".contains("b")) // expect: true
System.print("a\0b\0c".contains("b\0c")) // expect: true
System.print("a\0b\0c".contains("bc")) // expect: false
@@ -1 +0,0 @@
"foo".contains(1) // expect runtime error: Argument must be a string.
-18
View File
@@ -1,18 +0,0 @@
System.print("".count) // expect: 0
System.print("a string".count) // expect: 8
// 8-bit clean.
System.print("\0".count) // expect: 1
System.print("a\0b".count) // expect: 3
System.print("\0c".count) // expect: 2
System.print(("a\0b" + "\0c").count) // expect: 5
// Treats a UTF-8 sequence as a single item.
//
// Bytes: 11111
// 012345678901234
// Chars: sø mé ஃ thî ng
System.print("søméஃthîng".count) // expect: 10
// Counts invalid UTF-8 one byte at a time.
System.print("\xefok\xf7".count) // expect: 4
-15
View File
@@ -1,15 +0,0 @@
System.print("abcd".endsWith("cd")) // expect: true
System.print("abcd".endsWith("abcde")) // expect: false
System.print("abcd".endsWith("abcd")) // expect: true
System.print("abcd".endsWith("f")) // expect: false
System.print("abcd".endsWith("")) // expect: true
// Non-ASCII.
System.print("søméthîng".endsWith("thîng")) // expect: true
System.print("søméthîng".endsWith("thing")) // expect: false
// 8-bit clean.
System.print("a\0b\0c".endsWith("\0")) // expect: false
System.print("a\0b\0c".endsWith("c")) // expect: true
System.print("a\0b\0c".endsWith("\0c")) // expect: true
System.print("a\0b\0c".endsWith("\0b")) // expect: false
@@ -1 +0,0 @@
System.print("abcd".endsWith(null)) // expect runtime error: Argument must be a string.
-28
View File
@@ -1,28 +0,0 @@
System.print("" == "") // expect: true
System.print("abcd" == "abcd") // expect: true
System.print("abcd" == "d") // expect: false
System.print("e" == "abcd") // expect: false
System.print("" == "abcd") // expect: false
// Not equal to other types.
System.print("1" == 1) // expect: false
System.print("true" == true) // expect: false
System.print("" != "") // expect: false
System.print("abcd" != "abcd") // expect: false
System.print("abcd" != "d") // expect: true
System.print("e" != "abcd") // expect: true
System.print("" != "abcd") // expect: true
// Not equal to other types.
System.print("1" != 1) // expect: true
System.print("true" != true) // expect: true
// Non-ASCII.
System.print("vålue" == "value") // expect: false
System.print("vålue" == "vålue") // expect: true
// 8-bit clean.
System.print("a\0b\0c" == "a") // expect: false
System.print("a\0b\0c" == "abc") // expect: false
System.print("a\0b\0c" == "a\0b\0c") // expect: true
-3
View File
@@ -1,3 +0,0 @@
System.print(String.fromByte(65)) // expect: A
System.print(String.fromByte(0).bytes[0]) // expect: 0
System.print(String.fromByte(255).bytes[0]) // expect: 255
-1
View File
@@ -1 +0,0 @@
System.print(String.fromByte(12.34)) // expect runtime error: Byte must be an integer.
-1
View File
@@ -1 +0,0 @@
System.print(String.fromByte("not num")) // expect runtime error: Byte must be a number.
@@ -1 +0,0 @@
System.print(String.fromByte(0xff + 1)) // expect runtime error: Byte cannot be greater than 0xff.
@@ -1 +0,0 @@
System.print(String.fromByte(-1)) // expect runtime error: Byte cannot be negative.
-5
View File
@@ -1,5 +0,0 @@
System.print(String.fromCodePoint(65)) // expect: A
System.print(String.fromCodePoint(164)) // expect: ¤
System.print(String.fromCodePoint(398)) // expect: Ǝ
System.print(String.fromCodePoint(8225)) // expect: ‡
System.print(String.fromCodePoint(0x254b)) // expect: ╋
@@ -1 +0,0 @@
System.print(String.fromCodePoint(12.34)) // expect runtime error: Code point must be an integer.
@@ -1 +0,0 @@
System.print(String.fromCodePoint("not num")) // expect runtime error: Code point must be a number.
@@ -1,3 +0,0 @@
// UTF-8 mandates that only values up to 10ffff can be encoded.
// See: http://tools.ietf.org/html/rfc3629
System.print(String.fromCodePoint(0x10ffff + 1)) // expect runtime error: Code point cannot be greater than 0x10ffff.
@@ -1 +0,0 @@
System.print(String.fromCodePoint(-1)) // expect runtime error: Code point cannot be negative.
-24
View File
@@ -1,24 +0,0 @@
System.print("abcd".indexOf("")) // expect: 0
System.print("abcd".indexOf("cd")) // expect: 2
System.print("abcd".indexOf("a")) // expect: 0
System.print("abcd".indexOf("abcd")) // expect: 0
System.print("abcd".indexOf("abcde")) // expect: -1
System.print("abab".indexOf("ab")) // expect: 0
// More complex cases.
System.print("abcdefabcdefg".indexOf("defg")) // expect: 9
System.print("abcdabcdabcd".indexOf("dab")) // expect: 3
System.print("abcdabcdabcdabcd".indexOf("dabcdabc")) // expect: 3
System.print("abcdefg".indexOf("abcdef!")) // expect: -1
// Non-ASCII. Note that it returns byte indices, not code points.
System.print("søméஃthîng".indexOf("e")) // expect: -1
System.print("søméஃthîng".indexOf("m")) // expect: 3
System.print("søméஃthîng".indexOf("thî")) // expect: 9
// 8-bit clean.
System.print("a\0b\0c".indexOf("\0")) // expect: 1
System.print("a\0b\0c".indexOf("a")) // expect: 0
System.print("a\0b\0c".indexOf("b\0c")) // expect: 2
System.print("a\0b\0c".indexOf("a\0b\0c\0d")) // expect: -1
System.print("a\0b\0a\0b".indexOf("a\0b")) // expect: 0
@@ -1 +0,0 @@
System.print("abcd".indexOf(null)) // expect runtime error: Argument must be a string.
-39
View File
@@ -1,39 +0,0 @@
// An empty string is anywhere you look for it.
System.print("abcd".indexOf("", 0)) // expect: 0
System.print("abcd".indexOf("", 1)) // expect: 1
System.print("abcd".indexOf("", 2)) // expect: 2
// Overlapping results.
System.print("aaaaa".indexOf("aaaa", 0)) // expect: 0
System.print("aaaaa".indexOf("aaaa", 1)) // expect: 1
System.print("aaaaa".indexOf("aaaa", 2)) // expect: -1
// It's OK if the needle extends past the end.
System.print("abcd".indexOf("abcde", 0)) // expect: -1
System.print("abcd".indexOf("cde", 3)) // expect: -1
System.print("abcd".indexOf("cd", 0)) // expect: 2
System.print("abcd".indexOf("cd", 1)) // expect: 2
System.print("abcd".indexOf("cd", 2)) // expect: 2
System.print("abcd".indexOf("cd", 3)) // expect: -1
// Negative start.
System.print("abcd".indexOf("cd", -4)) // expect: 2
System.print("abcd".indexOf("cd", -3)) // expect: 2
System.print("abcd".indexOf("cd", -2)) // expect: 2
System.print("abcd".indexOf("cd", -1)) // expect: -1
// Skips past earlier results.
System.print("here as well as here".indexOf("here", 1)) // expect: 16
// Non-ASCII. Note that it returns byte indices, not code points.
System.print("søméஃthîng".indexOf("e", 2)) // expect: -1
System.print("søméஃthîng".indexOf("m", 2)) // expect: 3
System.print("søméஃthîng".indexOf("thî", 8)) // expect: 9
// 8-bit clean.
System.print("a\0b\0c".indexOf("\0", 0)) // expect: 1
System.print("a\0b\0c".indexOf("a", 0)) // expect: 0
System.print("a\0b\0c".indexOf("b\0c", 1)) // expect: 2
System.print("a\0b\0c".indexOf("a\0b\0c\0d", 0)) // expect: -1
System.print("a\0b\0a\0b".indexOf("a\0b", 0)) // expect: 0
@@ -1 +0,0 @@
"abcd".indexOf("bc", 12.34) // expect runtime error: Start must be an integer.
@@ -1,2 +0,0 @@
"abcd".indexOf("bc", "not num") // expect runtime error: Start must be a number.
System.print("after")
@@ -1 +0,0 @@
"abcd".indexOf("bc", 4) // expect runtime error: Start out of bounds.
@@ -1 +0,0 @@
"abcd".indexOf("bc", -5) // expect runtime error: Start out of bounds.
-29
View File
@@ -1,29 +0,0 @@
var s = "abçd"
System.print(s.iterate(null)) // expect: 0
System.print(s.iterate(0)) // expect: 1
System.print(s.iterate(1)) // expect: 2
// Skip 3 because that's the middle of the ç sequence.
System.print(s.iterate(2)) // expect: 4
// Iterating from the middle of a UTF-8 sequence goes to the next one.
System.print(s.iterate(3)) // expect: 4
System.print(s.iterate(4)) // expect: false
// Out of bounds.
System.print(s.iterate(123)) // expect: false
System.print(s.iterate(-1)) // expect: false
// Nothing to iterate in an empty string.
System.print("".iterate(null)) // expect: false
// 8-bit clean.
System.print("a\0b\0c".iterate(null)) // expect: 0
System.print("a\0b\0c".iterate(0)) // expect: 1
System.print("a\0b\0c".iterate(1)) // expect: 2
System.print("a\0b\0c".iterate(2)) // expect: 3
System.print("a\0b\0c".iterate(3)) // expect: 4
System.print("a\0b\0c".iterate(4)) // expect: false
// Iterates over invalid UTF-8 one byte at a time.
System.print("\xef\xf7".iterate(null)) // expect: 0
System.print("\xef\xf7".iterate(0)) // expect: 1
System.print("\xef\xf7".iterate(1)) // expect: false
@@ -1 +0,0 @@
"s".iterate(1.5) // expect runtime error: Iterator must be an integer.
@@ -1 +0,0 @@
"s".iterate("2") // expect runtime error: Iterator must be a number.
-19
View File
@@ -1,19 +0,0 @@
var s = "abçd"
System.print(s.iteratorValue(0)) // expect: a
System.print(s.iteratorValue(1)) // expect: b
System.print(s.iteratorValue(2)) // expect: ç
// Iterator value in middle of UTF sequence is the unencoded byte.
System.print(s.iteratorValue(3) == "\xa7") // expect: true
System.print(s.iteratorValue(4)) // expect: d
// 8-bit clean.
var t = "a\0b\0c"
System.print(t.iteratorValue(0) == "a") // expect: true
System.print(t.iteratorValue(1) == "\0") // expect: true
System.print(t.iteratorValue(2) == "b") // expect: true
System.print(t.iteratorValue(3) == "\0") // expect: true
System.print(t.iteratorValue(4) == "c") // expect: true
// Returns single byte strings for invalid UTF-8 sequences.
System.print("\xef\xf7".iteratorValue(0) == "\xef") // expect: true
System.print("\xef\xf7".iteratorValue(1) == "\xf7") // expect: true
@@ -1 +0,0 @@
"s".iteratorValue(1.5) // expect runtime error: Iterator must be an integer.
@@ -1 +0,0 @@
"s".iteratorValue("2") // expect runtime error: Iterator must be a number.
@@ -1 +0,0 @@
"123".iteratorValue(4) // expect runtime error: Iterator out of bounds.
@@ -1 +0,0 @@
"123".iteratorValue(-5) // expect runtime error: Iterator out of bounds.
-10
View File
@@ -1,10 +0,0 @@
var str = "string"
System.print(str.join("") == str) // expect: true
System.print(str.join(", ")) // expect: s, t, r, i, n, g
// 8-bit clean.
var ing = "a\0b\0c"
System.print(ing.join("") == ing) // expect: true
System.print(ing.join(", ") == "a, \0, b, \0, c") // expect: true
@@ -1 +0,0 @@
"string".join(2) // // expect runtime error: Right operand must be a string.
-3
View File
@@ -1,3 +0,0 @@
System.print("|" + "abc" * 0 + "|") // expect: ||
System.print("abc" * 1) // expect: abc
System.print("abc" * 4) // expect: abcabcabcabc
-1
View File
@@ -1 +0,0 @@
"abc" * -3 // expect runtime error: Count must be a non-negative integer.
-1
View File
@@ -1 +0,0 @@
"abc" * 1.2 // expect runtime error: Count must be a non-negative integer.
-1
View File
@@ -1 +0,0 @@
"abc" * "not num" // expect runtime error: Count must be a non-negative integer.
-1
View File
@@ -1 +0,0 @@
String.new() // expect runtime error: String metaclass does not implement 'new()'.
-2
View File
@@ -1,2 +0,0 @@
System.print(!"s") // expect: false
System.print(!"") // expect: false
-17
View File
@@ -1,17 +0,0 @@
System.print("something".replace("some", "no")) // expect: nothing
System.print("something".replace("thing", "one")) // expect: someone
System.print("something".replace("ometh", "umm")) // expect: summing
System.print("something".replace("math", "ton")) // expect: something
// Multiple.
System.print("somethingsomething".replace("some", "no")) // expect: nothingnothing
System.print("abc abc abc".replace(" ", "")) // expect: abcabcabc
System.print("abcabcabc".replace("abc", "")) // expect:
// Non-ASCII.
System.print("søméthîng".replace("sømé", "nø")) // expect: nøthîng
System.print("søméthîng".replace("meth", "ton")) // expect: søméthîng
// 8-bit clean.
System.print("a\0b\0c".replace("\0", "")) // expect: abc
System.print("a\0b\0c".replace("b", "") == "a\0\0c") // expect: true
-1
View File
@@ -1 +0,0 @@
"foo".replace("", "f") // expect runtime error: From must be a non-empty string.
@@ -1 +0,0 @@
"foo".replace("o", 1) // expect runtime error: To must be a string.
@@ -1 +0,0 @@
"foo".replace(1, "o") // expect runtime error: From must be a non-empty string.
-16
View File
@@ -1,16 +0,0 @@
System.print("something".split("meth")) // expect: [so, ing]
System.print("something".split("some")) // expect: [, thing]
System.print("something".split("ing")) // expect: [someth, ]
System.print("something".split("math")) // expect: [something]
// Multiple.
System.print("somethingsomething".split("meth")) // expect: [so, ingso, ing]
System.print("abc abc abc".split(" ")) // expect: [abc, abc, abc]
System.print("abcabcabc".split("abc")) // expect: [, , , ]
// Non-ASCII.
System.print("søméthîng".split("méth")) // expect: [sø, îng]
System.print("søméthîng".split("meth")) // expect: [søméthîng]
// 8-bit clean.
System.print("a\0b\0c".split("\0")) // expect: [a, b, c]
@@ -1 +0,0 @@
"foo".split(1) // expect runtime error: Delimiter must be a non-empty string.
@@ -1 +0,0 @@
"foo".split("") // expect runtime error: Delimiter must be a non-empty string.
-14
View File
@@ -1,14 +0,0 @@
System.print("abcd".startsWith("cd")) // expect: false
System.print("abcd".startsWith("a")) // expect: true
System.print("abcd".startsWith("abcd")) // expect: true
System.print("abcd".startsWith("abcde")) // expect: false
System.print("abcd".startsWith("")) // expect: true
// Non-ASCII.
System.print("søméthîng".startsWith("sømé")) // expect: true
System.print("søméthîng".startsWith("some")) // expect: false
// 8-bit clean.
System.print("a\0b\0c".startsWith("a")) // expect: true
System.print("a\0b\0c".startsWith("a\0")) // expect: true
System.print("a\0b\0c".startsWith("b\0")) // expect: false
@@ -1 +0,0 @@
System.print("abcd".startsWith(null)) // expect runtime error: Argument must be a string.
-46
View File
@@ -1,46 +0,0 @@
// Returns characters (as strings).
System.print("abcd"[0]) // expect: a
System.print("abcd"[1]) // expect: b
System.print("abcd"[2]) // expect: c
System.print("abcd"[3]) // expect: d
// Allows indexing backwards from the end.
System.print("abcd"[-4]) // expect: a
System.print("abcd"[-3]) // expect: b
System.print("abcd"[-2]) // expect: c
System.print("abcd"[-1]) // expect: d
// Regression: Make sure the string's internal buffer size is correct.
System.print("abcd"[1] == "b") // expect: true
// Indexes by byte, not code point.
//
// Bytes: 11111
// 012345678901234
// Chars: sø mé ஃ thî ng
System.print("søméஃthîng"[0]) // expect: s
System.print("søméஃthîng"[1]) // expect: ø
System.print("søméஃthîng"[3]) // expect: m
System.print("søméஃthîng"[6]) // expect: ஃ
System.print("søméஃthîng"[10]) // expect: h
System.print("søméஃthîng"[-1]) // expect: g
System.print("søméஃthîng"[-2]) // expect: n
System.print("søméஃthîng"[-4]) // expect: î
// If the subscript is in the middle of a UTF-8 sequence, return the raw byte.
System.print("søméஃthîng"[2] == "\xb8") // expect: true
System.print("søméஃthîng"[7] == "\xae") // expect: true
System.print("søméஃthîng"[8] == "\x83") // expect: true
System.print("søméஃ"[-1] == "\x83") // expect: true
System.print("søméஃ"[-2] == "\xae") // expect: true
// 8-bit clean.
System.print("a\0b\0c"[0] == "a") // expect: true
System.print("a\0b\0c"[1] == "\0") // expect: true
System.print("a\0b\0c"[2] == "b") // expect: true
System.print("a\0b\0c"[3] == "\0") // expect: true
System.print("a\0b\0c"[4] == "c") // expect: true
// Returns single byte strings for invalid UTF-8 sequences.
System.print("\xef\xf7"[0] == "\xef") // expect: true
System.print("\xef\xf7"[1] == "\xf7") // expect: true
-2
View File
@@ -1,2 +0,0 @@
var a = "123"
a[1.5] // expect runtime error: Subscript must be an integer.
-2
View File
@@ -1,2 +0,0 @@
var a = "123"
a["2"] // expect runtime error: Subscript must be a number or a range.
-53
View File
@@ -1,53 +0,0 @@
var string = "abcde"
System.print(string[0..0]) // expect: a
System.print(string[1...1] == "") // expect: true
System.print(string[1..2]) // expect: bc
System.print(string[1...2]) // expect: b
System.print(string[2..4]) // expect: cde
System.print(string[2...5]) // expect: cde
// A backwards range reverses.
System.print(string[3..1]) // expect: dcb
System.print(string[3...1]) // expect: dc
System.print(string[3...3] == "") // expect: true
// Negative ranges index from the end.
System.print(string[-5..-2]) // expect: abcd
System.print(string[-5...-2]) // expect: abc
System.print(string[-3..-5]) // expect: cba
System.print(string[-3...-6]) // expect: cba
// Half-negative ranges are treated like the negative value is fixed before
// walking the range.
System.print(string[-5..3]) // expect: abcd
System.print(string[-3...5]) // expect: cde
System.print(string[-2..1]) // expect: dcb
System.print(string[-2...0]) // expect: dcb
System.print(string[1..-2]) // expect: bcd
System.print(string[2...-1]) // expect: cd
System.print(string[4..-5]) // expect: edcba
System.print(string[3...-6]) // expect: dcba
// An empty range at zero is allowed on an empty string.
System.print(""[0...0] == "") // expect: true
System.print(""[0..-1] == "") // expect: true
// An empty range at the end is allowed on a string.
System.print("abc"[3...3] == "") // expect: true
System.print("abc"[3..-1] == "") // expect: true
// Indexes by byte, not code point.
//
// Bytes: 11111
// 012345678901234
// Chars: sø mé ஃ thî ng
System.print("søméஃthîng"[0..3]) // expect: søm
System.print("søméஃthîng"[3...10]) // expect: méஃt
// Only includes sequences whose first byte is in the range.
System.print("søméஃthîng"[2..6]) // expect: méஃ
System.print("søméஃthîng"[2...6]) // expect: mé
System.print("søméஃthîng"[2...7]) // expect: méஃ
// TODO: Strings including invalid UTF-8.
@@ -1,2 +0,0 @@
var a = "string"
a[1.5..2] // expect runtime error: Range start must be an integer.
@@ -1,2 +0,0 @@
var a = "123"
a[3..2] // expect runtime error: Range start out of bounds.
@@ -1,2 +0,0 @@
var a = "123"
a[-4..2] // expect runtime error: Range start out of bounds.
@@ -1,2 +0,0 @@
var a = "123"
a[1...4] // expect runtime error: Range end out of bounds.
@@ -1,2 +0,0 @@
var a = "123"
a[0...-5] // expect runtime error: Range end out of bounds.
@@ -1,2 +0,0 @@
var a = "string"
a[1..2.5] // expect runtime error: Range end must be an integer.
@@ -1,2 +0,0 @@
var a = "123"
a[1..3] // expect runtime error: Range end out of bounds.
@@ -1,2 +0,0 @@
var a = "123"
a[0..-4] // expect runtime error: Range end out of bounds.
@@ -1,2 +0,0 @@
var a = "123"
a[4] // expect runtime error: Subscript out of bounds.
@@ -1,2 +0,0 @@
var a = "123"
a[-5] // expect runtime error: Subscript out of bounds.
-7
View File
@@ -1,7 +0,0 @@
System.print("".toString == "") // expect: true
System.print("blah".toString == "blah") // expect: true
// 8-bit clean.
System.print("a\0b\0c".toString == "a\0b\0c") // expect: true
System.print("a\0b\0c".toString == "a") // expect: false
System.print("a\0b\0c".toString) // expect: a
-16
View File
@@ -1,16 +0,0 @@
System.print("".trim() == "") // expect: true
System.print("foo".trim() == "foo") // expect: true
System.print(" \t\r\nfoo b\tar \t\r\n".trim() == "foo b\tar") // expect: true
System.print(" \t\r\n \t\r\n".trim() == "") // expect: true
System.print(" \n\n\tsøméஃthîng \n\n\t".trim() == "søméஃthîng") // expect: true
System.print("".trim("abc") == "") // expect: true
System.print("foo".trim("abc") == "foo") // expect: true
System.print("foo".trim("") == "foo") // expect: true
System.print("cbacbfoobarab".trim("abc") == "foobar") // expect: true
System.print("abcbacba".trim("abc") == "") // expect: true
System.print("søméஃthîngsøméஃ".trim("ஃmésø") == "thîng") // expect: true
// 8-bit clean.
System.print(" \t\ra\0b \t\r".trim() == "a\0b") // expect: true
System.print("\0a\0b\0c\0".trim("c\0a") == "b") // expect: true
@@ -1 +0,0 @@
"abracadabra".trim(123) // expect runtime error: Characters must be a string.
-16
View File
@@ -1,16 +0,0 @@
System.print("".trimEnd() == "") // expect: true
System.print("foo".trimEnd() == "foo") // expect: true
System.print(" \t\r\nfoo b\tar \t\r\n".trimEnd() == " \t\r\nfoo b\tar") // expect: true
System.print(" \t\r\n \t\r\n".trimEnd() == "") // expect: true
System.print("søméஃthîng \n\n\t".trimEnd() == "søméஃthîng") // expect: true
System.print("".trimEnd("abc") == "") // expect: true
System.print("foo".trimEnd("abc") == "foo") // expect: true
System.print("foo".trimEnd("") == "foo") // expect: true
System.print("cbacbfoobarab".trimEnd("abc") == "cbacbfoobar") // expect: true
System.print("abcbacba".trimEnd("abc") == "") // expect: true
System.print("søméஃthîngsøméஃ".trimEnd("ஃmésø") == "søméஃthîng") // expect: true
// 8-bit clean.
System.print(" \t\ra\0b \t\r".trimEnd() == " \t\ra\0b") // expect: true
System.print("\0a\0b\0c\0".trimEnd("c\0") == "\0a\0b") // expect: true
@@ -1 +0,0 @@
"abracadabra".trimEnd(123) // expect runtime error: Characters must be a string.
-16
View File
@@ -1,16 +0,0 @@
System.print("".trimStart() == "") // expect: true
System.print("foo".trimStart() == "foo") // expect: true
System.print(" \t\r\nfoo b\tar \t\r\n".trimStart() == "foo b\tar \t\r\n") // expect: true
System.print(" \t\r\n \t\r\n".trimStart() == "") // expect: true
System.print(" \n\n\tsøméஃthîng".trimStart() == "søméஃthîng") // expect: true
System.print("".trimStart("abc") == "") // expect: true
System.print("foo".trimStart("abc") == "foo") // expect: true
System.print("foo".trimStart("") == "foo") // expect: true
System.print("cbacbfoobarab".trimStart("abc") == "foobarab") // expect: true
System.print("abcbacba".trimStart("abc") == "") // expect: true
System.print("søméஃthîng".trimStart("ஃmésø") == "thîng") // expect: true
// 8-bit clean.
System.print(" \t\ra\0b".trimStart() == "a\0b") // expect: true
System.print("\0a\0b\0c\0".trimStart("a\0") == "b\0c\0") // expect: true
@@ -1 +0,0 @@
"abracadabra".trimStart(123) // expect runtime error: Characters must be a string.
-4
View File
@@ -1,4 +0,0 @@
System.print("s" is String) // expect: true
System.print("s" is Object) // expect: true
System.print("s" is Num) // expect: false
System.print("s".type == String) // expect: true