opal 1.8.0.alpha1 → 1.8.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +1 -0
  3. data/README.md +7 -7
  4. data/UNRELEASED.md +14 -0
  5. data/docs/releasing.md +8 -16
  6. data/lib/opal/cli_runners/chrome.rb +5 -1
  7. data/lib/opal/nodes/closure.rb +15 -7
  8. data/lib/opal/nodes/defined.rb +1 -1
  9. data/lib/opal/nodes/literal.rb +10 -6
  10. data/lib/opal/nodes/rescue.rb +1 -1
  11. data/lib/opal/simple_server.rb +2 -2
  12. data/lib/opal/version.rb +1 -1
  13. data/opal/corelib/array.rb +39 -21
  14. data/opal/corelib/class.rb +26 -8
  15. data/opal/corelib/complex.rb +1 -1
  16. data/opal/corelib/constants.rb +2 -2
  17. data/opal/corelib/enumerator/arithmetic_sequence.rb +1 -1
  18. data/opal/corelib/error.rb +10 -0
  19. data/opal/corelib/hash.rb +30 -18
  20. data/opal/corelib/kernel.rb +0 -1
  21. data/opal/corelib/module.rb +44 -5
  22. data/opal/corelib/number.rb +28 -1
  23. data/opal/corelib/range.rb +1 -1
  24. data/opal/corelib/rational.rb +1 -1
  25. data/opal/corelib/runtime.js +124 -42
  26. data/opal/corelib/string.rb +36 -8
  27. data/opal/corelib/struct.rb +1 -1
  28. data/opal/corelib/time.rb +1 -1
  29. data/spec/filters/bugs/array.rb +58 -0
  30. data/spec/filters/bugs/basicobject.rb +7 -0
  31. data/spec/filters/bugs/bigdecimal.rb +1 -2
  32. data/spec/filters/bugs/binding.rb +1 -0
  33. data/spec/filters/bugs/class.rb +2 -3
  34. data/spec/filters/bugs/complex.rb +3 -0
  35. data/spec/filters/bugs/date.rb +5 -2
  36. data/spec/filters/bugs/datetime.rb +1 -0
  37. data/spec/filters/bugs/delegate.rb +1 -2
  38. data/spec/filters/bugs/encoding.rb +1 -1
  39. data/spec/filters/bugs/enumerable.rb +11 -0
  40. data/spec/filters/bugs/enumerator.rb +15 -2
  41. data/spec/filters/bugs/exception.rb +9 -4
  42. data/spec/filters/bugs/file.rb +2 -0
  43. data/spec/filters/bugs/float.rb +1 -0
  44. data/spec/filters/bugs/freeze.rb +5 -49
  45. data/spec/filters/bugs/hash.rb +1 -0
  46. data/spec/filters/bugs/integer.rb +5 -6
  47. data/spec/filters/bugs/kernel.rb +12 -5
  48. data/spec/filters/bugs/language.rb +33 -15
  49. data/spec/filters/bugs/marshal.rb +63 -4
  50. data/spec/filters/bugs/method.rb +2 -10
  51. data/spec/filters/bugs/module.rb +18 -7
  52. data/spec/filters/bugs/objectspace.rb +2 -0
  53. data/spec/filters/bugs/pathname.rb +1 -0
  54. data/spec/filters/bugs/proc.rb +4 -2
  55. data/spec/filters/bugs/random.rb +0 -3
  56. data/spec/filters/bugs/range.rb +1 -1
  57. data/spec/filters/bugs/rational.rb +2 -0
  58. data/spec/filters/bugs/refinement.rb +19 -0
  59. data/spec/filters/bugs/regexp.rb +27 -5
  60. data/spec/filters/bugs/ruby-32.rb +0 -4
  61. data/spec/filters/bugs/set.rb +10 -2
  62. data/spec/filters/bugs/singleton.rb +0 -2
  63. data/spec/filters/bugs/string.rb +140 -1
  64. data/spec/filters/bugs/struct.rb +15 -5
  65. data/spec/filters/bugs/time.rb +56 -2
  66. data/spec/filters/bugs/trace_point.rb +1 -0
  67. data/spec/filters/bugs/unboundmethod.rb +4 -9
  68. data/spec/filters/bugs/warnings.rb +0 -1
  69. data/spec/filters/platform/firefox/exception.rb +3 -3
  70. data/spec/filters/platform/firefox/kernel.rb +1 -0
  71. data/spec/filters/platform/safari/exception.rb +2 -2
  72. data/spec/filters/platform/safari/float.rb +1 -0
  73. data/spec/filters/platform/safari/kernel.rb +1 -0
  74. data/spec/filters/platform/safari/literal_regexp.rb +2 -2
  75. data/spec/filters/unsupported/hash.rb +1 -1
  76. data/spec/lib/compiler_spec.rb +4 -0
  77. data/spec/opal/core/class/clone_spec.rb +36 -0
  78. data/spec/opal/core/object_id_spec.rb +0 -6
  79. data/spec/opal/language/predefined_spec.rb +20 -0
  80. data/spec/opal/language/yield_spec.rb +43 -0
  81. data/spec/ruby_specs +0 -2
  82. data/stdlib/bigdecimal.rb +2 -0
  83. data/stdlib/delegate.rb +3 -4
  84. data/stdlib/pathname.rb +1 -1
  85. data/stdlib/promise/v2.rb +22 -7
  86. data/stdlib/stringio.rb +2 -0
  87. data/tasks/testing.rake +15 -11
  88. data/test/opal/promisev2/test_always.rb +14 -0
  89. data/test/opal/unsupported_and_bugs.rb +0 -8
  90. metadata +10 -6
@@ -1,5 +1,27 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "regular_expressions" do
3
+ fails "MatchData#byteoffset accepts String as a reference to a named capture" # NoMethodError: undefined method `byteoffset' for #<MatchData "foobar" f:"foo" b:"bar">
4
+ fails "MatchData#byteoffset accepts Symbol as a reference to a named capture" # NoMethodError: undefined method `byteoffset' for #<MatchData "foobar" f:"foo" b:"bar">
5
+ fails "MatchData#byteoffset converts argument into integer if is not String nor Symbol" # NoMethodError: undefined method `byteoffset' for #<MatchData "foobar" f:"foo" b:"bar">
6
+ fails "MatchData#byteoffset raises IndexError if index is out of matches" # Expected IndexError (index -1 out of matches) but got: NoMethodError (undefined method `byteoffset' for #<MatchData "foobar" f:"foo" b:"bar">)
7
+ fails "MatchData#byteoffset raises IndexError if there is no group with provided name" # Expected IndexError (undefined group name reference: y) but got: NoMethodError (undefined method `byteoffset' for #<MatchData "foobar" f:"foo" b:"bar">)
8
+ fails "MatchData#byteoffset raises TypeError if can't convert argument into Integer" # Expected TypeError (no implicit conversion of Array into Integer) but got: NoMethodError (undefined method `byteoffset' for #<MatchData "foobar" f:"foo" b:"bar">)
9
+ fails "MatchData#byteoffset returns [nil, nil] if a capturing group is optional and doesn't match for multi-byte string" # NoMethodError: undefined method `byteoffset' for #<MatchData "あぃい" 1:"ぃ" 2:nil 3:"い">
10
+ fails "MatchData#byteoffset returns [nil, nil] if a capturing group is optional and doesn't match" # NoMethodError: undefined method `byteoffset' for #<MatchData "" x:nil>
11
+ fails "MatchData#byteoffset returns beginning and ending byte-based offset of n-th match, all the subsequent elements are capturing groups" # NoMethodError: undefined method `byteoffset' for #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
12
+ fails "MatchData#byteoffset returns beginning and ending byte-based offset of whole matched substring for 0 element" # NoMethodError: undefined method `byteoffset' for #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
13
+ fails "MatchData#byteoffset returns correct beginning and ending byte-based offset for multi-byte strings" # NoMethodError: undefined method `byteoffset' for #<MatchData "あぃい" 1:"ぃ" 2:nil 3:"い">
14
+ fails "MatchData#deconstruct returns an array of the match captures" # NoMethodError: undefined method `deconstruct' for #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
15
+ fails "MatchData#deconstruct returns instances of String when given a String subclass" # NoMethodError: undefined method `deconstruct' for #<MatchData "HX1138" 1:"H" 2:"X" 3:"113" 4:"8">
16
+ fails "MatchData#deconstruct_keys does not accept non-Symbol keys" # Expected TypeError (wrong argument type String (expected Symbol)) but got: NoMethodError (undefined method `deconstruct_keys' for #<MatchData "foobar" f:"foo" b:"bar">)
17
+ fails "MatchData#deconstruct_keys it raises error when argument is neither nil nor array" # Expected TypeError (wrong argument type Integer (expected Array)) but got: NoMethodError (undefined method `deconstruct_keys' for #<MatchData "foobar" f:"foo" b:"bar">)
18
+ fails "MatchData#deconstruct_keys process keys till the first non-existing one" # NoMethodError: undefined method `deconstruct_keys' for #<MatchData "foobarbaz" f:"foo" b:"bar" c:"baz">
19
+ fails "MatchData#deconstruct_keys requires one argument" # Expected ArgumentError (wrong number of arguments (given 0, expected 1)) but got: NoMethodError (undefined method `deconstruct_keys' for #<MatchData "l">)
20
+ fails "MatchData#deconstruct_keys returns only specified keys" # NoMethodError: undefined method `deconstruct_keys' for #<MatchData "foobar" f:"foo" b:"bar">
21
+ fails "MatchData#deconstruct_keys returns whole hash for nil as an argument" # NoMethodError: undefined method `deconstruct_keys' for #<MatchData "foobar" f:"foo" b:"bar">
22
+ fails "MatchData#deconstruct_keys returns {} when passed []" # NoMethodError: undefined method `deconstruct_keys' for #<MatchData "foobar" f:"foo" b:"bar">
23
+ fails "MatchData#deconstruct_keys returns {} when passed more keys than named captured groups" # NoMethodError: undefined method `deconstruct_keys' for #<MatchData "foobar" f:"foo" b:"bar">
24
+ fails "MatchData#deconstruct_keys returns {} when there are no named captured groups at all" # NoMethodError: undefined method `deconstruct_keys' for #<MatchData "foobar">
3
25
  fails "MatchData#regexp returns a Regexp for the result of gsub(String)" # Expected /\[/gm == /\[/ to be truthy but was false
4
26
  fails "MatchData#string returns a frozen copy of the matched string for gsub(String)" # NotImplementedError: String#gsub! not supported. Mutable String methods are not supported in Opal.
5
27
  fails "MatchData.allocate is undefined" # Expected NoMethodError but no exception was raised (#<MatchData>(#pretty_inspect raised #<NoMethodError: undefined method `named_captures' for nil>) was returned)
@@ -39,12 +61,7 @@ opal_filter "regular_expressions" do
39
61
  fails "Regexp#to_s shows the pattern after the options" # Expected "xyz" == "(?-mix:xyz)" to be truthy but was false
40
62
  fails "Regexp.compile given a Regexp does not honour options given as additional arguments" # Expected warning to match: /flags ignored/ but got: ""
41
63
  fails "Regexp.compile given a String accepts an Integer of two or more options ORed together as the second argument" # Expected 0 == 0 to be falsy but was true
42
- fails "Regexp.compile given a String ignores the third argument if it is 'e' or 'euc' (case-insensitive)" # ArgumentError: [Regexp.new] wrong number of arguments (given 3, expected -2)
43
- fails "Regexp.compile given a String ignores the third argument if it is 's' or 'sjis' (case-insensitive)" # ArgumentError: [Regexp.new] wrong number of arguments (given 3, expected -2)
44
- fails "Regexp.compile given a String ignores the third argument if it is 'u' or 'utf8' (case-insensitive)" # ArgumentError: [Regexp.new] wrong number of arguments (given 3, expected -2)
45
64
  fails "Regexp.compile given a String raises a RegexpError when passed an incorrect regexp" # Expected RegexpError but got: Exception (Invalid regular expression: /^[$/: Unterminated character class)
46
- fails "Regexp.compile given a String uses ASCII_8BIT encoding if third argument is 'n' or 'none' (case insensitive) and non-ascii characters" # ArgumentError: [Regexp.new] wrong number of arguments (given 3, expected -2)
47
- fails "Regexp.compile given a String uses US_ASCII encoding if third argument is 'n' or 'none' (case insensitive) and only ascii characters" # ArgumentError: [Regexp.new] wrong number of arguments (given 3, expected -2)
48
65
  fails "Regexp.compile given a String with escaped characters raises a RegexpError if \\x is not followed by any hexadecimal digits" # Expected RegexpError but no exception was raised (/\xn/ was returned)
49
66
  fails "Regexp.compile given a String with escaped characters raises a RegexpError if less than four digits are given for \\uHHHH" # Expected RegexpError but no exception was raised (/\u304/ was returned)
50
67
  fails "Regexp.compile given a String with escaped characters raises a RegexpError if more than six hexadecimal digits are given" # Expected RegexpError but no exception was raised (/\u{0ffffff}/ was returned)
@@ -58,6 +75,10 @@ opal_filter "regular_expressions" do
58
75
  fails "Regexp.compile given a String with escaped characters returns a Regexp with the input String's encoding" # NameError: uninitialized constant Encoding::Shift_JIS
59
76
  fails "Regexp.compile works by default for subclasses with overridden #initialize" # Expected /hi/ (Regexp) to be kind of RegexpSpecsSubclass
60
77
  fails "Regexp.escape sets the encoding of the result to BINARY if any non-US-ASCII characters are present in an input String with invalid encoding" # Expected true to be false
78
+ fails "Regexp.linear_time? accepts flags for string argument" # NoMethodError: undefined method `linear_time?' for Regexp
79
+ fails "Regexp.linear_time? return false if matching can't be done in linear time" # NoMethodError: undefined method `linear_time?' for Regexp
80
+ fails "Regexp.linear_time? returns true if matching can be done in linear time" # NoMethodError: undefined method `linear_time?' for Regexp
81
+ fails "Regexp.linear_time? warns about flags being ignored for regexp arguments" # NoMethodError: undefined method `linear_time?' for Regexp
61
82
  fails "Regexp.new given a String accepts an Integer of two or more options ORed together as the second argument" # Expected 0 == 0 to be falsy but was true
62
83
  fails "Regexp.new given a String raises a RegexpError when passed an incorrect regexp" # Expected RegexpError but got: Exception (Invalid regular expression: /^[$/: Unterminated character class)
63
84
  fails "Regexp.new given a String with escaped characters raises a RegexpError if \\x is not followed by any hexadecimal digits" # Expected RegexpError but no exception was raised (/\xn/ was returned)
@@ -66,6 +87,7 @@ opal_filter "regular_expressions" do
66
87
  fails "Regexp.new given a non-String/Regexp raises TypeError if there is no #to_str method for non-String/Regexp argument" # Expected TypeError (no implicit conversion of Integer into String) but got: TypeError (no implicit conversion of Number into String)
67
88
  fails "Regexp.new works by default for subclasses with overridden #initialize" # Expected /hi/ (Regexp) to be kind of RegexpSpecsSubclass
68
89
  fails "Regexp.quote sets the encoding of the result to BINARY if any non-US-ASCII characters are present in an input String with invalid encoding" # Expected true to be false
90
+ fails "Regexp.try_convert raises a TypeError if the object does not return an Regexp from #to_regexp" # Expected TypeError (can't convert MockObject to Regexp (MockObject#to_regexp gives String)) but got: NoMethodError (undefined method `try_convert' for Regexp)
69
91
  fails "Regexp.try_convert returns nil if given an argument that can't be converted to a Regexp" # NoMethodError: undefined method `try_convert' for Regexp
70
92
  fails "Regexp.try_convert tries to coerce the argument by calling #to_regexp" # Mock 'regexp' expected to receive to_regexp("any_args") exactly 1 times but received it 0 times
71
93
  fails "Regexp.union uses to_regexp to convert argument" # Mock 'pattern' expected to receive to_regexp("any_args") exactly 1 times but received it 0 times
@@ -1,8 +1,6 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "Ruby 3.2" do
3
3
  fails "A block yielded a single Array does not autosplat single argument to required arguments when a keyword rest argument is present" # ArgumentError: expected kwargs
4
- fails "Data is a new constant" # NameError: uninitialized constant Data
5
- fails "Data is not deprecated" # NameError: uninitialized constant Data
6
4
  fails "Fixnum is no longer defined" # Expected Object.const_defined? "Fixnum" to be falsy but was true
7
5
  fails "Kernel#=~ is no longer defined" # Expected #<Object:0x11214>.respond_to? "=~" to be falsy but was true
8
6
  fails "Kernel#sprintf other formats c displays no characters if argument is an empty string" # ArgumentError: %c requires a character
@@ -43,8 +41,6 @@ opal_filter "Ruby 3.2" do
43
41
  fails "String#dedup returns self if the String is frozen" # NoMethodError: undefined method `dedup' for "foo"
44
42
  fails "String#dedup returns the same object for equal unfrozen strings" # Expected "this is a string" not to be identical to "this is a string"
45
43
  fails "String#dedup returns the same object when it's called on the same String literal" # NoMethodError: undefined method `dedup' for "unfrozen string"
46
- fails "StringIO#each when passed a separator yields each paragraph with all separation characters when passed an empty String as separator" # Expected ["para1\n" + "\n", "para2\n" + "\n", "para3"] == ["para1\n" + "\n", "para2\n" + "\n" + "\n", "para3"] to be truthy but was false
47
- fails "StringIO#each_line when passed a separator yields each paragraph with all separation characters when passed an empty String as separator" # Expected ["para1\n" + "\n", "para2\n" + "\n", "para3"] == ["para1\n" + "\n", "para2\n" + "\n" + "\n", "para3"] to be truthy but was false
48
44
  fails "Struct.new on subclasses accepts keyword arguments to initialize" # Expected #<struct args={"args"=>42}> == #<struct args=42> to be truthy but was false
49
45
  fails "Struct.new raises a TypeError if passed a Hash with an unknown key" # Expected TypeError but no exception was raised (#<Class:0x356> was returned)
50
46
  fails "Symbol#to_proc only calls public methods" # Expected NoMethodError (/protected method `pro' called/) but no exception was raised (#<MSpecEnv:0x146c8 @a=["pub", "pro"]> was returned)
@@ -16,8 +16,12 @@ opal_filter "Set" do
16
16
  fails "Set#compare_by_identity regards #clone'd objects as having different identities" # Expected ["a"] == ["a", "a"] to be truthy but was false
17
17
  fails "Set#compare_by_identity regards #dup'd objects as having different identities" # Expected ["a"] == ["a", "a"] to be truthy but was false
18
18
  fails "Set#divide divides self into a set of subsets based on the blocks return values" # NoMethodError: undefined method `divide' for #<Set: {one,two,three,four,five}>
19
+ fails "Set#divide returns an enumerator when not passed a block" # NoMethodError: undefined method `divide' for #<Set: {1,2,3,4}>
19
20
  fails "Set#divide when passed a block with an arity of 2 divides self into a set of subsets based on the blocks return values" # NoMethodError: undefined method `divide' for #<Set: {1,3,4,6,9,10,11}>
21
+ fails "Set#divide when passed a block with an arity of 2 returns an enumerator when not passed a block" # NoMethodError: undefined method `divide' for #<Set: {1,2,3,4}>
20
22
  fails "Set#divide when passed a block with an arity of 2 yields each two Object to the block" # NoMethodError: undefined method `divide' for #<Set: {1,2}>
23
+ fails "Set#divide when passed a block with an arity of > 2 only uses the first element if the arity = -1" # NoMethodError: undefined method `divide' for #<Set: {one,two,three,four,five}>
24
+ fails "Set#divide when passed a block with an arity of > 2 only uses the first element if the arity > 2" # NoMethodError: undefined method `divide' for #<Set: {one,two,three,four,five}>
21
25
  fails "Set#divide yields each Object to the block" # NoMethodError: undefined method `divide' for #<Set: {one,two,three,four,five}>
22
26
  fails "Set#flatten raises an ArgumentError when self is recursive" # Expected ArgumentError but got: NoMethodError (undefined method `flatten' for #<Set: {#<Set:0xb7b90>}>)
23
27
  fails "Set#flatten returns a copy of self with each included Set flattened" # NoMethodError: undefined method `flatten' for #<Set: {1,2,#<Set:0xb7b9c>,9,10}>
@@ -33,7 +37,9 @@ opal_filter "Set" do
33
37
  fails "Set#initialize uses #each on the provided Enumerable if it does not respond to #each_entry" # ArgumentError: value must be enumerable
34
38
  fails "Set#initialize uses #each_entry on the provided Enumerable" # ArgumentError: value must be enumerable
35
39
  fails "Set#initialize_clone does not freeze the new Set when called from clone(freeze: false)" # FrozenError: can't modify frozen Hash: {1=>true, 2=>true}
36
- fails "Set#inspect correctly handles self-references" # Expected "#<Set: {#<Set:0xa64>}>" to include "#<Set: {...}>"
40
+ fails "Set#inspect correctly handles cyclic-references" # Expected "#<Set: {#<Set:0x2e8c>}>" to include "#<Set: {...}>"
41
+ fails "Set#inspect does include the elements of the set" # Expected "#<Set: {1}>" == "#<Set: {\"1\"}>" to be truthy but was false
42
+ fails "Set#inspect puts spaces between the elements" # Expected "#<Set: {1,2}>" to include "\", \""
37
43
  fails "Set#intersection raises an ArgumentError when passed a non-Enumerable" # Expected ArgumentError but got: NoMethodError (undefined method `intersection' for #<Set: {a,b,c}>)
38
44
  fails "Set#intersection returns a new Set containing only elements shared by self and the passed Enumerable" # NoMethodError: undefined method `intersection' for #<Set: {a,b,c}>
39
45
  fails "Set#join calls #to_a to convert the Set in to an Array" # NoMethodError: undefined method `join' for #<Set: {a,b,c}>
@@ -43,6 +49,8 @@ opal_filter "Set" do
43
49
  fails "Set#join returns an empty string if the Set is empty" # NoMethodError: undefined method `join' for #<Set: {}>
44
50
  fails "Set#merge raises an ArgumentError when passed a non-Enumerable" # Expected ArgumentError but got: NoMethodError (undefined method `each' for 1)
45
51
  fails "Set#pretty_print_cycle passes the 'pretty print' representation of a self-referencing Set to the pretty print writer" # Mock 'PrettyPrint' expected to receive text("#<Set: {...}>") exactly 1 times but received it 0 times
46
- fails "Set#to_s correctly handles self-references" # Expected "#<Set:0x9d6>" to include "#<Set: {...}>"
52
+ fails "Set#to_s correctly handles cyclic-references" # Expected "#<Set:0xb920e>" to include "#<Set: {...}>"
53
+ fails "Set#to_s does include the elements of the set" # Expected "#<Set:0xb9246>" == "#<Set: {\"1\"}>" to be truthy but was false
47
54
  fails "Set#to_s is an alias of inspect" # Expected #<Method: Set#to_s (defined in Kernel in <internal:corelib/kernel.rb>:768)> == #<Method: Set#inspect (defined in Set in ./set.rb:36)> to be truthy but was false
55
+ fails "Set#to_s puts spaces between the elements" # Expected "#<Set:0xb9274>" to include "\", \""
48
56
  end
@@ -2,6 +2,4 @@
2
2
  opal_filter "Singleton" do
3
3
  fails "Singleton._load returns the singleton instance for anything passed in to subclass" # NoMethodError: undefined method `_load' for SingletonSpecs::MyClassChild
4
4
  fails "Singleton._load returns the singleton instance for anything passed in" # NoMethodError: undefined method `_load' for SingletonSpecs::MyClass
5
- fails "Singleton.instance returns an instance of the singleton's clone" # Exception: self.$$constructor is not a constructor
6
- fails "Singleton.instance returns the same instance for multiple class to instance on clones" # Exception: self.$$constructor is not a constructor
7
5
  end
@@ -61,6 +61,7 @@ opal_filter "String" do
61
61
  fails "String#+ when the argument is in an ASCII-incompatible encoding incompatible with self's encoding raises Encoding::CompatibilityError if neither are empty" # Expected CompatibilityError but no exception was raised ("xy" was returned)
62
62
  fails "String#-@ does not deduplicate a frozen string when it has instance variables" # Exception: Cannot create property 'a' on string 'this string is frozen'
63
63
  fails "String#-@ returns the same object for equal unfrozen strings" # Expected "this is a string" not to be identical to "this is a string"
64
+ fails "String#<< raises a NoMethodError if the given argument raises a NoMethodError during type coercion to a String" # Expected NoMethodError but got: NotImplementedError (String#<< not supported. Mutable String methods are not supported in Opal.)
64
65
  fails "String#<< when self is BINARY and argument is US-ASCII uses BINARY encoding" # NotImplementedError: String#<< not supported. Mutable String methods are not supported in Opal.
65
66
  fails "String#<< with Integer returns a BINARY string if self is US-ASCII and the argument is between 128-255 (inclusive)" # NotImplementedError: String#<< not supported. Mutable String methods are not supported in Opal.
66
67
  fails "String#<=> with String compares the indices of the encodings when the strings have identical non-ASCII-compatible bytes" # Expected 0 == -1 to be truthy but was false
@@ -81,6 +82,72 @@ opal_filter "String" do
81
82
  fails "String#[] with String returns a String instance when given a subclass instance" # Expected "el" (StringSpecs::MyString) to be an instance of String
82
83
  fails "String#[] with index, length raises a RangeError if the index or length is too big" # Expected RangeError but no exception was raised (nil was returned)
83
84
  fails "String#[] with index, length returns a string with the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
85
+ fails "String#byteindex calls #to_int to convert the second argument" # Mock 'string index offset' expected to receive to_int("any_args") exactly 1 times but received it 0 times
86
+ fails "String#byteindex calls #to_str to convert the first argument" # Mock 'string index char' expected to receive to_str("any_args") exactly 1 times but received it 0 times
87
+ fails "String#byteindex does not raise IndexError when byte offset is correct or on string boundary" # NoMethodError: undefined method `byteindex' for "わ"
88
+ fails "String#byteindex raises on type errors raises a TypeError if passed a Symbol" # Expected TypeError (no implicit conversion of MockObject into String) but got: NoMethodError (undefined method `byteindex' for "hello")
89
+ fails "String#byteindex raises on type errors raises a TypeError if passed a boolean" # Expected TypeError (no implicit conversion of true into String) but got: NoMethodError (undefined method `byteindex' for "abc")
90
+ fails "String#byteindex raises on type errors raises a TypeError if passed an Integer" # Expected TypeError (no implicit conversion of Integer into String) but got: NoMethodError (undefined method `byteindex' for "abc")
91
+ fails "String#byteindex raises on type errors raises a TypeError if passed nil" # Expected TypeError (no implicit conversion of nil into String) but got: NoMethodError (undefined method `byteindex' for "abc")
92
+ fails "String#byteindex with Regexp behaves the same as String#byteindex(string) for escaped string regexps" # NoMethodError: undefined method `byteindex' for "blablabla"
93
+ fails "String#byteindex with Regexp converts start_offset to an integer via to_int" # Mock '1' expected to receive to_int("any_args") exactly 1 times but received it 0 times
94
+ fails "String#byteindex with Regexp returns nil if the Regexp matches the empty string and the offset is out of range" # NoMethodError: undefined method `byteindex' for "ruby"
95
+ fails "String#byteindex with Regexp returns nil if the substring isn't found" # NoMethodError: undefined method `byteindex' for "blablabla"
96
+ fails "String#byteindex with Regexp returns the byteindex of the first match of regexp" # NoMethodError: undefined method `byteindex' for "blablabla"
97
+ fails "String#byteindex with Regexp returns the character byteindex after offset" # NoMethodError: undefined method `byteindex' for "われわれ"
98
+ fails "String#byteindex with Regexp returns the character byteindex of a multibyte character" # NoMethodError: undefined method `byteindex' for "ありがとう"
99
+ fails "String#byteindex with Regexp starts the search at offset + self.length if offset is negative" # NoMethodError: undefined method `byteindex' for "blablabla"
100
+ fails "String#byteindex with Regexp starts the search at the given offset" # NoMethodError: undefined method `byteindex' for "blablabla"
101
+ fails "String#byteindex with Regexp supports \\G which matches at the given start offset" # NoMethodError: undefined method `byteindex' for "helloYOU."
102
+ fails "String#byteindex with Regexp treats the offset as a byteindex" # NoMethodError: undefined method `byteindex' for "われわわれ"
103
+ fails "String#byteindex with String behaves the same as String#byteindex(char) for one-character strings" # NoMethodError: undefined method `byteindex' for "b"
104
+ fails "String#byteindex with String handles a substring in a subset encoding" # NoMethodError: undefined method `byteindex' for "été"
105
+ fails "String#byteindex with String handles a substring in a superset encoding" # NoMethodError: undefined method `byteindex' for "abc"
106
+ fails "String#byteindex with String ignores string subclasses" # NoMethodError: undefined method `byteindex' for "blablabla"
107
+ fails "String#byteindex with String raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
108
+ fails "String#byteindex with String returns nil if the substring isn't found" # NoMethodError: undefined method `byteindex' for "blablabla"
109
+ fails "String#byteindex with String returns the byteindex of the first occurrence of the given substring" # NoMethodError: undefined method `byteindex' for "blablabla"
110
+ fails "String#byteindex with String returns the character byteindex after a partial first match" # NoMethodError: undefined method `byteindex' for "</</h"
111
+ fails "String#byteindex with String returns the character byteindex after offset" # NoMethodError: undefined method `byteindex' for "われわれ"
112
+ fails "String#byteindex with String returns the character byteindex of a multibyte character" # NoMethodError: undefined method `byteindex' for "ありがとう"
113
+ fails "String#byteindex with String starts the search at offset + self.length if offset is negative" # NoMethodError: undefined method `byteindex' for "blablabla"
114
+ fails "String#byteindex with String starts the search at the given offset" # NoMethodError: undefined method `byteindex' for "blablabla"
115
+ fails "String#byteindex with String treats the offset as a byteindex" # NoMethodError: undefined method `byteindex' for "aaaaa"
116
+ fails "String#byteindex with global variables doesn't set $~ for non regex search" # NoMethodError: undefined method `byteindex' for "hello."
117
+ fails "String#byteindex with global variables sets $~ to MatchData of match and nil when there's none" # NoMethodError: undefined method `byteindex' for "hello."
118
+ fails "String#byteindex with multibyte codepoints raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
119
+ fails "String#byteindex with multibyte codepoints raises an IndexError when byte offset lands in the middle of a multibyte character" # Expected IndexError (offset 1 does not land on character boundary) but got: NoMethodError (undefined method `byteindex' for "わ")
120
+ fails "String#byterindex with Regexp behaves the same as String#byterindex(string) for escaped string regexps" # NoMethodError: undefined method `byterindex' for "blablabla"
121
+ fails "String#byterindex with Regexp raises a TypeError when given offset is nil" # Expected TypeError but got: NoMethodError (undefined method `byterindex' for "str")
122
+ fails "String#byterindex with Regexp returns nil if the substring isn't found" # NoMethodError: undefined method `byterindex' for "blablabla"
123
+ fails "String#byterindex with Regexp returns the character index before the finish" # NoMethodError: undefined method `byterindex' for "ありがりがとう"
124
+ fails "String#byterindex with Regexp returns the index of the first match from the end of string of regexp" # NoMethodError: undefined method `byterindex' for "blablabla"
125
+ fails "String#byterindex with Regexp returns the reverse byte index of a multibyte character" # NoMethodError: undefined method `byterindex' for "ありがりがとう"
126
+ fails "String#byterindex with Regexp starts the search at offset + self.length if offset is negative" # NoMethodError: undefined method `byterindex' for "blablabla"
127
+ fails "String#byterindex with Regexp starts the search at the given offset" # NoMethodError: undefined method `byterindex' for "blablabla"
128
+ fails "String#byterindex with Regexp tries to convert start_offset to an integer" # NoMethodError: undefined method `byterindex' for "str"
129
+ fails "String#byterindex with String behaves the same as String#byterindex(?char) for one-character strings" # NoMethodError: undefined method `byterindex' for "b"
130
+ fails "String#byterindex with String behaves the same as String#byterindex(char) for one-character strings" # NoMethodError: undefined method `byterindex' for "b"
131
+ fails "String#byterindex with String handles a substring in a subset encoding" # NoMethodError: undefined method `byterindex' for "été"
132
+ fails "String#byterindex with String handles a substring in a superset encoding" # NoMethodError: undefined method `byterindex' for "abc"
133
+ fails "String#byterindex with String ignores string subclasses" # NoMethodError: undefined method `byterindex' for "blablabla"
134
+ fails "String#byterindex with String raises a TypeError when given offset is nil" # Expected TypeError but got: NoMethodError (undefined method `byterindex' for "str")
135
+ fails "String#byterindex with String returns nil if the substring isn't found" # NoMethodError: undefined method `byterindex' for "blablabla"
136
+ fails "String#byterindex with String returns the index of the last occurrence of the given substring" # NoMethodError: undefined method `byterindex' for "blablabla"
137
+ fails "String#byterindex with String starts the search at offset + self.length if offset is negative" # NoMethodError: undefined method `byterindex' for "blablabla"
138
+ fails "String#byterindex with String starts the search at the given offset" # NoMethodError: undefined method `byterindex' for "blablabla"
139
+ fails "String#byterindex with String tries to convert start_offset to an integer via to_int" # NoMethodError: undefined method `byterindex' for "str"
140
+ fails "String#byterindex with object calls #to_int to convert the second argument" # Mock 'string index offset' expected to receive to_int("any_args") exactly 1 times but received it 0 times
141
+ fails "String#byterindex with object does not raise IndexError when byte offset is correct or on string boundary" # NoMethodError: undefined method `byterindex' for "わ"
142
+ fails "String#byterindex with object raises on type errors raises a TypeError if passed a Symbol" # Expected TypeError (no implicit conversion of MockObject into String) but got: NoMethodError (undefined method `byterindex' for "hello")
143
+ fails "String#byterindex with object raises on type errors raises a TypeError if passed a boolean" # Expected TypeError (no implicit conversion of true into String) but got: NoMethodError (undefined method `byterindex' for "abc")
144
+ fails "String#byterindex with object raises on type errors raises a TypeError if passed an Integer" # Expected TypeError (no implicit conversion of Integer into String) but got: NoMethodError (undefined method `byterindex' for "abc")
145
+ fails "String#byterindex with object raises on type errors raises a TypeError if passed nil" # Expected TypeError (no implicit conversion of nil into String) but got: NoMethodError (undefined method `byterindex' for "abc")
146
+ fails "String#byterindex with object tries to convert obj to a string via to_str" # NoMethodError: undefined method `byterindex' for "hello"
147
+ fails "String#byterindex with object with global variables doesn't set $~ for non regex search" # NoMethodError: undefined method `byterindex' for "hello."
148
+ fails "String#byterindex with object with global variables sets $~ to MatchData of match and nil when there's none" # NoMethodError: undefined method `byterindex' for "hello."
149
+ fails "String#byterindex with object with multibyte codepoints raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
150
+ fails "String#byterindex with object with multibyte codepoints raises an IndexError when byte offset lands in the middle of a multibyte character" # Expected IndexError (offset 1 does not land on character boundary) but got: NoMethodError (undefined method `byterindex' for "わ")
84
151
  fails "String#bytes yields each byte to a block if one is given, returning self" # Expected [230, 157, 177, 228, 186, 172] == "東京" to be truthy but was false
85
152
  fails "String#byteslice on on non ASCII strings returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
86
153
  fails "String#byteslice raises a RangeError if the index is too big" # Expected RangeError but no exception was raised (nil was returned)
@@ -89,6 +156,24 @@ opal_filter "String" do
89
156
  fails "String#byteslice with Range returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
90
157
  fails "String#byteslice with index, length raises a RangeError if the index or length is too big" # Expected RangeError but no exception was raised (nil was returned)
91
158
  fails "String#byteslice with index, length returns a string with the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
159
+ fails "String#bytesplice mutates self" # NoMethodError: undefined method `bytesplice' for "hello"
160
+ fails "String#bytesplice raises IndexError for negative length" # Expected IndexError (negative length -2) but got: NoMethodError (undefined method `bytesplice' for "abc")
161
+ fails "String#bytesplice raises IndexError when index is greater than bytesize" # Expected IndexError (index 6 out of string) but got: NoMethodError (undefined method `bytesplice' for "hello")
162
+ fails "String#bytesplice raises IndexError when index is less than -bytesize" # Expected IndexError (index -6 out of string) but got: NoMethodError (undefined method `bytesplice' for "hello")
163
+ fails "String#bytesplice raises RangeError when range left boundary is less than -bytesize" # Expected RangeError (-6...-6 out of range) but got: NoMethodError (undefined method `bytesplice' for "hello")
164
+ fails "String#bytesplice raises TypeError when integer index is provided without length argument" # Expected TypeError (wrong argument type Integer (expected Range)) but got: NoMethodError (undefined method `bytesplice' for "hello")
165
+ fails "String#bytesplice raises when string is frozen" # Expected FrozenError (can't modify frozen String: "hello") but got: NoMethodError (undefined method `bytesplice' for "hello")
166
+ fails "String#bytesplice replaces on an empty string" # NoMethodError: undefined method `bytesplice' for ""
167
+ fails "String#bytesplice replaces with integer indices" # NoMethodError: undefined method `bytesplice' for "hello"
168
+ fails "String#bytesplice replaces with ranges" # NoMethodError: undefined method `bytesplice' for "hello"
169
+ fails "String#bytesplice with multibyte characters deals with a different encoded argument" # NoMethodError: undefined method `bytesplice' for "こんにちは"
170
+ fails "String#bytesplice with multibyte characters raises IndexError when index is not on a codepoint boundary" # Expected IndexError (offset 1 does not land on character boundary) but got: NoMethodError (undefined method `bytesplice' for "こんにちは")
171
+ fails "String#bytesplice with multibyte characters raises IndexError when index is out of byte size boundary" # Expected IndexError (index -16 out of string) but got: NoMethodError (undefined method `bytesplice' for "こんにちは")
172
+ fails "String#bytesplice with multibyte characters raises IndexError when length is not matching the codepoint boundary" # Expected IndexError (offset 1 does not land on character boundary) but got: NoMethodError (undefined method `bytesplice' for "こんにちは")
173
+ fails "String#bytesplice with multibyte characters raises when ranges not match codepoint boundaries" # Expected IndexError (offset 1 does not land on character boundary) but got: NoMethodError (undefined method `bytesplice' for "こんにちは")
174
+ fails "String#bytesplice with multibyte characters replaces with integer indices" # NoMethodError: undefined method `bytesplice' for "こんにちは"
175
+ fails "String#bytesplice with multibyte characters replaces with range" # NoMethodError: undefined method `bytesplice' for "こんにちは"
176
+ fails "String#bytesplice with multibyte characters treats negative length for range as 0" # NoMethodError: undefined method `bytesplice' for "こんにちは"
92
177
  fails "String#capitalize ASCII-only case mapping does not capitalize non-ASCII characters" # ArgumentError: [String#capitalize] wrong number of arguments (given 1, expected 0)
93
178
  fails "String#capitalize ASCII-only case mapping handles non-ASCII substrings properly" # ArgumentError: [String#capitalize] wrong number of arguments (given 1, expected 0)
94
179
  fails "String#capitalize full Unicode case mapping adapted for Lithuanian allows Turkic as an extra option (and applies Turkic semantics)" # ArgumentError: [String#capitalize] wrong number of arguments (given 2, expected 0)
@@ -98,6 +183,7 @@ opal_filter "String" do
98
183
  fails "String#capitalize full Unicode case mapping only capitalizes the first resulting character when upcasing a character produces a multi-character sequence" # Expected "SS" == "Ss" to be truthy but was false
99
184
  fails "String#capitalize full Unicode case mapping updates string metadata" # Expected "SSet" == "Sset" to be truthy but was false
100
185
  fails "String#capitalize returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
186
+ fails "String#capitalize! raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#capitalize! not supported. Mutable String methods are not supported in Opal.)
101
187
  fails "String#casecmp independent of case returns nil if incompatible encodings" # NameError: uninitialized constant Encoding::EUC_JP
102
188
  fails "String#casecmp? independent of case case folds" # Expected false to be true
103
189
  fails "String#casecmp? independent of case for UNICODE characters returns true when downcase(:fold) on unicode" # Expected false == true to be truthy but was false
@@ -105,15 +191,24 @@ opal_filter "String" do
105
191
  fails "String#casecmp? independent of case returns nil if incompatible encodings" # NameError: uninitialized constant Encoding::EUC_JP
106
192
  fails "String#chomp when passed no argument returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
107
193
  fails "String#chomp when passed no argument returns a copy of the String when it is not modified" # Expected "abc" not to be identical to "abc"
194
+ fails "String#chomp! raises a FrozenError on a frozen instance when it is modified" # Expected FrozenError but got: NotImplementedError (String#chomp! not supported. Mutable String methods are not supported in Opal.)
195
+ fails "String#chomp! raises a FrozenError on a frozen instance when it would not be modified" # Expected FrozenError but got: NotImplementedError (String#chomp! not supported. Mutable String methods are not supported in Opal.)
108
196
  fails "String#chop returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
197
+ fails "String#chop! raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#chop! not supported. Mutable String methods are not supported in Opal.)
198
+ fails "String#chop! raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#chop! not supported. Mutable String methods are not supported in Opal.)
199
+ fails "String#clear raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#clear not supported. Mutable String methods are not supported in Opal.)
109
200
  fails "String#clone calls #initialize_copy on the new instance" # Expected nil == "string" to be truthy but was false
110
201
  fails "String#clone copies singleton methods" # TypeError: can't define singleton
111
202
  fails "String#clone returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
203
+ fails "String#concat raises a NoMethodError if the given argument raises a NoMethodError during type coercion to a String" # Mock 'world!' expected to receive to_str("any_args") exactly 1 times but received it 0 times
112
204
  fails "String#concat when self is BINARY and argument is US-ASCII uses BINARY encoding" # NoMethodError: undefined method `concat' for "abc"
113
205
  fails "String#concat with Integer returns a BINARY string if self is US-ASCII and the argument is between 128-255 (inclusive)" # NoMethodError: undefined method `concat' for ""
114
206
  fails "String#delete returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
207
+ fails "String#delete! raises a FrozenError when self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `delete!' for "hello")
115
208
  fails "String#delete_prefix returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
209
+ fails "String#delete_prefix! raises a FrozenError when self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `delete_prefix!' for "hello")
116
210
  fails "String#delete_suffix returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
211
+ fails "String#delete_suffix! raises a FrozenError when self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `delete_suffix!' for "hello")
117
212
  fails "String#downcase ASCII-only case mapping does not downcase non-ASCII characters" # ArgumentError: [String#downcase] wrong number of arguments (given 1, expected 0)
118
213
  fails "String#downcase ASCII-only case mapping works with substrings" # ArgumentError: [String#downcase] wrong number of arguments (given 1, expected 0)
119
214
  fails "String#downcase case folding case folds special characters" # ArgumentError: [String#downcase] wrong number of arguments (given 1, expected 0)
@@ -122,6 +217,7 @@ opal_filter "String" do
122
217
  fails "String#downcase full Unicode case mapping adapted for Turkic languages allows Lithuanian as an extra option" # ArgumentError: [String#downcase] wrong number of arguments (given 2, expected 0)
123
218
  fails "String#downcase full Unicode case mapping adapted for Turkic languages downcases characters according to Turkic semantics" # ArgumentError: [String#downcase] wrong number of arguments (given 1, expected 0)
124
219
  fails "String#downcase returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
220
+ fails "String#downcase! raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#downcase! not supported. Mutable String methods are not supported in Opal.)
125
221
  fails "String#dump does not take into account if a string is frozen" # NoMethodError: undefined method `dump' for "foo"
126
222
  fails "String#dump includes .force_encoding(name) if the encoding isn't ASCII compatible" # NoMethodError: undefined method `dump' for "ࡶ"
127
223
  fails "String#dump returns a String in the same encoding as self" # NoMethodError: undefined method `dump' for "foo"
@@ -130,7 +226,8 @@ opal_filter "String" do
130
226
  fails "String#dump returns a string with \" and \\ escaped with a backslash" # NoMethodError: undefined method `dump' for "\""
131
227
  fails "String#dump returns a string with \\#<char> when # is followed by $, @, @@, {" # NoMethodError: undefined method `dump' for "\#$PATH"
132
228
  fails "String#dump returns a string with lower-case alpha characters unescaped" # NoMethodError: undefined method `dump' for "a"
133
- fails "String#dump returns a string with multi-byte UTF-8 characters replaced by \\u{} notation with upper-case hex digits" # NoMethodError: undefined method `dump' for "\u0080"
229
+ fails "String#dump returns a string with multi-byte UTF-8 characters greater than 0xFFFF replaced by \\u{XXXXXX} notation with upper-case hex digits" # NoMethodError: undefined method `dump' for "\u0000"
230
+ fails "String#dump returns a string with multi-byte UTF-8 characters less than or equal 0xFFFF replaced by \\uXXXX notation with upper-case hex digits" # NoMethodError: undefined method `dump' for "\u0080"
134
231
  fails "String#dump returns a string with non-printing ASCII characters replaced by \\x notation" # NoMethodError: undefined method `dump' for "\x00"
135
232
  fails "String#dump returns a string with non-printing single-byte UTF-8 characters replaced by \\x notation" # NoMethodError: undefined method `dump' for "\u0000"
136
233
  fails "String#dump returns a string with numeric characters unescaped" # NoMethodError: undefined method `dump' for "0"
@@ -155,15 +252,20 @@ opal_filter "String" do
155
252
  fails "String#each_grapheme_cluster works with multibyte characters" # NoMethodError: undefined method `each_grapheme_cluster' for "覇"
156
253
  fails "String#each_grapheme_cluster yields String instances for subclasses" # NoMethodError: undefined method `each_grapheme_cluster' for "abc"
157
254
  fails "String#each_line returns Strings in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
255
+ fails "String#encode when passed options replace multiple invalid bytes at the end with a single replacement character" # NoMethodError: undefined method `default_internal' for Encoding
158
256
  fails "String#encode when passed to, from, options returns a copy in the destination encoding when both encodings are the same" # NoMethodError: undefined method `default_internal' for Encoding
257
+ fails "String#encode! raises a FrozenError when called on a frozen String when it's a no-op" # NoMethodError: undefined method `default_internal' for Encoding
258
+ fails "String#encode! raises a FrozenError when called on a frozen String" # NoMethodError: undefined method `default_internal' for Encoding
159
259
  fails "String#encoding for Strings with \\x escapes returns BINARY when an escape creates a byte with the 8th bit set if the source encoding is US-ASCII" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
160
260
  fails "String#end_with? checks that we are starting to match at the head of a character" # Expected "ab".end_with? "b" to be falsy but was true
161
261
  fails "String#end_with? raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
162
262
  fails "String#eql? considers encoding compatibility" # Expected true to be false
163
263
  fails "String#eql? considers encoding difference of incompatible string" # Expected true to be false
164
264
  fails "String#eql? returns true when comparing 2 empty strings but one is not ASCII-compatible" # ArgumentError: unknown encoding name - iso-2022-jp
265
+ fails "String#force_encoding raises a FrozenError if self is frozen" # Expected FrozenError but no exception was raised ("abcd" was returned)
165
266
  fails "String#force_encoding with a special encoding name accepts valid special encoding names" # NoMethodError: undefined method `default_internal' for Encoding
166
267
  fails "String#force_encoding with a special encoding name defaults to BINARY if special encoding name is not set" # NoMethodError: undefined method `default_internal' for Encoding
268
+ fails "String#freeze doesn't produce the same object for different instances of literals in the source" # Expected "abc" not to be identical to "abc"
167
269
  fails "String#grapheme_clusters is unicode aware" # NoMethodError: undefined method `grapheme_clusters' for "Ç∂éƒg"
168
270
  fails "String#grapheme_clusters passes each char in self to the given block" # NoMethodError: undefined method `grapheme_clusters' for "hello"
169
271
  fails "String#grapheme_clusters passes each grapheme cluster in self to the given block" # NoMethodError: undefined method `grapheme_clusters' for "ab🏳️\u200D🌈🐾"
@@ -182,9 +284,13 @@ opal_filter "String" do
182
284
  fails "String#gsub with pattern and replacement handles a pattern in a superset encoding" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
183
285
  fails "String#gsub with pattern and replacement replaces \\k named backreferences with the regexp's corresponding capture" # Expected "h<\\k<foo>>ll<\\k<foo>>" == "h<e>ll<o>" to be truthy but was false
184
286
  fails "String#gsub with pattern and replacement supports \\G which matches at the beginning of the remaining (non-matched) string" # Expected "hello homely world. hah!" == "huh? huh? world. hah!" to be truthy but was false
287
+ fails "String#gsub! with pattern and block raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#gsub! not supported. Mutable String methods are not supported in Opal.)
288
+ fails "String#gsub! with pattern and replacement raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#gsub! not supported. Mutable String methods are not supported in Opal.)
185
289
  fails "String#include? with String raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
186
290
  fails "String#include? with String returns true if both strings are empty" # ArgumentError: unknown encoding name - EUC-JP
187
291
  fails "String#include? with String returns true if the RHS is empty" # ArgumentError: unknown encoding name - EUC-JP
292
+ fails "String#initialize with no arguments does not raise an exception when frozen" # Expected nil to be identical to "hello"
293
+ fails "String#insert with index, other raises a FrozenError if self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `insert' for "abcd")
188
294
  fails "String#insert with index, other should not call subclassed string methods" # NoMethodError: undefined method `insert' for "abcd"
189
295
  fails "String#inspect returns a string with non-printing characters replaced by \\x notation" # Expected "\"\\xA0\"" to be computed by " ".inspect (computed "\" \"" instead)
190
296
  fails "String#inspect uses \\x notation for broken UTF-8 sequences" # Expected "\"ð\\x9F\"" == "\"\\xF0\\x9F\"" to be truthy but was false
@@ -202,21 +308,31 @@ opal_filter "String" do
202
308
  fails "String#length returns the correct length after force_encoding(BINARY)" # Expected 2 == 4 to be truthy but was false
203
309
  fails "String#lines returns Strings in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
204
310
  fails "String#lstrip returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
311
+ fails "String#lstrip! raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#lstrip! not supported. Mutable String methods are not supported in Opal.)
312
+ fails "String#lstrip! raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#lstrip! not supported. Mutable String methods are not supported in Opal.)
205
313
  fails "String#next returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
206
314
  fails "String#ord raises ArgumentError if the character is broken" # Expected ArgumentError (invalid byte sequence in US-ASCII) but no exception was raised (169 was returned)
207
315
  fails "String#partition with String handles a pattern in a subset encoding" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
208
316
  fails "String#partition with String handles a pattern in a superset encoding" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
209
317
  fails "String#partition with String returns String instances when called on a subclass" # Expected "hello" (StringSpecs::MyString) to be an instance of String
210
318
  fails "String#partition with String returns before- and after- parts in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
319
+ fails "String#prepend raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#prepend not supported. Mutable String methods are not supported in Opal.)
211
320
  fails "String#reverse returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
212
321
  fails "String#reverse works with a broken string" # Expected true to be false
322
+ fails "String#reverse! raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#reverse! not supported. Mutable String methods are not supported in Opal.)
323
+ fails "String#reverse! raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#reverse! not supported. Mutable String methods are not supported in Opal.)
324
+ fails "String#rindex with String raises an Encoding::CompatibilityError if the encodings are incompatible" # ArgumentError: unknown encoding name - ISO-2022-JP
213
325
  fails "String#rpartition with String handles a pattern in a subset encoding" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
214
326
  fails "String#rpartition with String handles a pattern in a superset encoding" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
215
327
  fails "String#rpartition with String returns String instances when called on a subclass" # Expected "hello" (StringSpecs::MyString) to be an instance of String
216
328
  fails "String#rpartition with String returns before- and after- parts in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
217
329
  fails "String#rpartition with String returns new object if doesn't match" # Expected "hello".equal? "hello" to be falsy but was true
218
330
  fails "String#rstrip returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
331
+ fails "String#rstrip! raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NoMethodError (undefined method `rstrip!' for " hello ")
332
+ fails "String#rstrip! raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NoMethodError (undefined method `rstrip!' for "hello")
333
+ fails "String#rstrip! raises an Encoding::CompatibilityError if the last non-space codepoint is invalid" # Expected true to be false
219
334
  fails "String#scan returns Strings in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
335
+ fails "String#setbyte raises a FrozenError if self is frozen" # Expected FrozenError but got: NoMethodError (undefined method `setbyte' for "cold")
220
336
  fails "String#size adds 1 (and not 2) for a incomplete surrogate in UTF-16" # Expected 2 == 1 to be truthy but was false
221
337
  fails "String#size adds 1 for a broken sequence in UTF-32" # Expected 4 == 1 to be truthy but was false
222
338
  fails "String#size returns the correct length after force_encoding(BINARY)" # Expected 2 == 4 to be truthy but was false
@@ -230,6 +346,14 @@ opal_filter "String" do
230
346
  fails "String#slice with String returns a String instance when given a subclass instance" # Expected "el" (StringSpecs::MyString) to be an instance of String
231
347
  fails "String#slice with index, length raises a RangeError if the index or length is too big" # Expected RangeError but no exception was raised (nil was returned)
232
348
  fails "String#slice with index, length returns a string with the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
349
+ fails "String#slice! Range raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
350
+ fails "String#slice! Range raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
351
+ fails "String#slice! with Regexp raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
352
+ fails "String#slice! with Regexp raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
353
+ fails "String#slice! with Regexp, index raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
354
+ fails "String#slice! with String raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
355
+ fails "String#slice! with index raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
356
+ fails "String#slice! with index, length raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#slice! not supported. Mutable String methods are not supported in Opal.)
233
357
  fails "String#split with Regexp allows concurrent Regexp calls in a shared context" # NotImplementedError: Thread creation not available
234
358
  fails "String#split with Regexp for a String subclass yields instances of String" # Expected nil (NilClass) to be an instance of String
235
359
  fails "String#split with Regexp raises a TypeError when not called with nil, String, or Regexp" # Expected TypeError but no exception was raised (["he", "o"] was returned)
@@ -255,12 +379,17 @@ opal_filter "String" do
255
379
  fails "String#split with String throws an ArgumentError if the string is not a valid" # Expected ArgumentError but no exception was raised (["ß"] was returned)
256
380
  fails "String#split with String when $; is not nil warns" # Expected warning to match: /warning: \$; is set to non-nil value/ but got: ""
257
381
  fails "String#squeeze returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
382
+ fails "String#squeeze! raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#squeeze! not supported. Mutable String methods are not supported in Opal.)
258
383
  fails "String#start_with? does not check that we are not matching part of a character" # Expected "é".start_with? "Ã" to be truthy but was false
259
384
  fails "String#start_with? does not check we are matching only part of a character" # Expected "あ".start_with? "ã" to be truthy but was false
260
385
  fails "String#strip returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
386
+ fails "String#strip! raises a FrozenError on a frozen instance that is modified" # Expected FrozenError but got: NotImplementedError (String#strip! not supported. Mutable String methods are not supported in Opal.)
387
+ fails "String#strip! raises a FrozenError on a frozen instance that would not be modified" # Expected FrozenError but got: NotImplementedError (String#strip! not supported. Mutable String methods are not supported in Opal.)
261
388
  fails "String#sub with pattern, replacement handles a pattern in a superset encoding" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
262
389
  fails "String#sub with pattern, replacement returns a copy of self when no modification is made" # Expected "hello" not to be identical to "hello"
263
390
  fails "String#sub with pattern, replacement supports \\G which matches at the beginning of the string" # Expected "hello world!" == "hi world!" to be truthy but was false
391
+ fails "String#sub! with pattern and block raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#sub! not supported. Mutable String methods are not supported in Opal.)
392
+ fails "String#sub! with pattern, replacement raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#sub! not supported. Mutable String methods are not supported in Opal.)
264
393
  fails "String#succ returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
265
394
  fails "String#swapcase ASCII-only case mapping does not swapcase non-ASCII characters" # ArgumentError: [String#swapcase] wrong number of arguments (given 1, expected 0)
266
395
  fails "String#swapcase ASCII-only case mapping works with substrings" # ArgumentError: [String#swapcase] wrong number of arguments (given 1, expected 0)
@@ -271,9 +400,12 @@ opal_filter "String" do
271
400
  fails "String#swapcase full Unicode case mapping updates string metadata" # Expected "aßET" == "aSSET" to be truthy but was false
272
401
  fails "String#swapcase full Unicode case mapping works for all of Unicode with no option" # Expected "äÖü" == "ÄöÜ" to be truthy but was false
273
402
  fails "String#swapcase returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
403
+ fails "String#swapcase! raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#swapcase! not supported. Mutable String methods are not supported in Opal.)
274
404
  fails "String#to_c allows null-byte" # Expected (1-2i) == (1+0i) to be truthy but was false
275
405
  fails "String#to_c ignores leading whitespaces" # Expected (79+79i) == (79+4i) to be truthy but was false
406
+ fails "String#to_c ignores trailing garbage" # Expected (79+40i) == (7+0i) to be truthy but was false
276
407
  fails "String#to_c raises Encoding::CompatibilityError if String is in not ASCII-compatible encoding" # Expected CompatibilityError (ASCII incompatible encoding: UTF-16) but got: ArgumentError (unknown encoding name - UTF-16)
408
+ fails "String#to_c treats a sequence of underscores as an end of Complex string" # Expected (5+31i) == (5+0i) to be truthy but was false
277
409
  fails "String#to_c understands 'a+i' to mean a complex number with 'a' as the real part, 1i as the imaginary" # Expected (79+0i) == (79+1i) to be truthy but was false
278
410
  fails "String#to_c understands 'a-i' to mean a complex number with 'a' as the real part, -1i as the imaginary" # Expected (79+0i) == (79-1i) to be truthy but was false
279
411
  fails "String#to_c understands 'm@a' to mean a complex number in polar form with 'm' as the modulus, 'a' as the argument" # Expected (79+4i) == (-51.63784604822534-59.78739712932633i) to be truthy but was false
@@ -285,6 +417,10 @@ opal_filter "String" do
285
417
  fails "String#to_sym returns a US-ASCII Symbol for a binary String containing only US-ASCII characters" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
286
418
  fails "String#to_sym returns a UTF-16LE Symbol for a UTF-16LE String containing non US-ASCII characters" # Expected #<Encoding:UTF-8> == #<Encoding:UTF-16LE> to be truthy but was false
287
419
  fails "String#to_sym returns a binary Symbol for a binary String containing non US-ASCII characters" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
420
+ fails "String#tr accepts c1-c1 notation to denote range of one character" # Expected "1yy456789" == "1xy456789" to be truthy but was false
421
+ fails "String#tr! raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#tr! not supported. Mutable String methods are not supported in Opal.)
422
+ fails "String#tr_s accepts c1-c1 notation to denote range of one character" # Expected "1y456789" == "1xy456789" to be truthy but was false
423
+ fails "String#tr_s! raises a FrozenError if self is frozen" # Expected FrozenError but got: NotImplementedError (String#tr_s! not supported. Mutable String methods are not supported in Opal.)
288
424
  fails "String#undump Limitations cannot undump non ASCII-compatible string" # Expected CompatibilityError but got: NoMethodError (undefined method `undump' for "\"foo\"")
289
425
  fails "String#undump always returns String instance" # NoMethodError: undefined method `undump' for "\"foo\""
290
426
  fails "String#undump does not take into account if a string is frozen" # NoMethodError: undefined method `undump' for "\"foo\""
@@ -328,8 +464,11 @@ opal_filter "String" do
328
464
  fails "String#upcase full Unicode case mapping adapted for Turkic languages allows Lithuanian as an extra option" # ArgumentError: [String#upcase] wrong number of arguments (given 2, expected 0)
329
465
  fails "String#upcase full Unicode case mapping adapted for Turkic languages upcases ASCII characters according to Turkic semantics" # ArgumentError: [String#upcase] wrong number of arguments (given 1, expected 0)
330
466
  fails "String#upcase returns a String in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
467
+ fails "String#upcase! raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#upcase! not supported. Mutable String methods are not supported in Opal.)
468
+ fails "String#upto raises Encoding::CompatibilityError when incompatible characters are given" # ArgumentError: unknown encoding name - EUC-JP
331
469
  fails "String#valid_encoding? returns true for IBM720 encoding self is valid in" # ArgumentError: unknown encoding name - IBM720
332
470
  fails "String.new accepts an encoding argument" # ArgumentError: unknown encoding name - euc-jp
333
471
  fails "String.new is called on subclasses" # Expected "subclass" == "" to be truthy but was false
472
+ fails "String.try_convert sends #to_str to the argument and raises TypeError if it's not a kind of String" # Expected TypeError (can't convert MockObject to String (MockObject#to_str gives Object)) but got: TypeError (can't convert MockObject into String (MockObject#to_str gives Object))
334
473
  fails_badly "String#split with Regexp returns Strings in the same encoding as self" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
335
474
  end
@@ -2,14 +2,24 @@
2
2
  opal_filter "Struct" do
3
3
  fails "Struct#dig returns the value by the index" # Expected nil == "one" to be truthy but was false
4
4
  fails "Struct#hash returns different hashes for structs with different values when using keyword_init: true" # NameError: wrong constant name 1 non symbol member
5
- fails "Struct#hash returns the same integer for structs with the same content" # Expected "Hash" (String) to be kind of Integer
6
- fails "Struct#initialize warns about passing only keyword arguments" # Expected warning to match: /warning: Passing only keyword arguments/ but got: ""
5
+ fails "Struct#initialize can be initialized with keyword arguments" # Expected "3.2" == {"version"=>"3.2", "platform"=>"OS"} to be truthy but was false
6
+ fails "Struct#inspect does not call #name method when struct is anonymous" # Expected "#<struct #<Class:0x55d36> a=\"\">" == "#<struct a=\"\">" to be truthy but was false
7
7
  fails "Struct#to_h with block converts [key, value] pairs returned by the block to a hash" # Expected {"Ford"=>"", "Ranger"=>"", ""=>""} == {"make"=>"ford", "model"=>"ranger", "year"=>""} to be truthy but was false
8
- fails "Struct-based class#dup retains an included module in the ancestor chain for the struct's singleton class" # NoMethodError: undefined method `hello' for #<Module:0x776e4>
8
+ fails "Struct#to_s does not call #name method when struct is anonymous" # Expected "#<struct #<Class:0x29fd6> a=\"\">" == "#<struct a=\"\">" to be truthy but was false
9
+ fails "Struct#values_at supports mixing of names and indices" # TypeError: no implicit conversion of String into Integer
10
+ fails "Struct#values_at when passed a list of Integers returns nil value for any integer that is out of range" # Exception: Cannot read properties of undefined (reading '$$is_array')
11
+ fails "Struct#values_at when passed an integer Range fills with nil values for range elements larger than the captured values number" # Exception: Cannot read properties of undefined (reading '$$is_array')
12
+ fails "Struct#values_at when passed an integer Range fills with nil values for range elements larger than the structure" # IndexError: offset 3 too large for struct(size:3)
13
+ fails "Struct#values_at when passed an integer Range raises RangeError if any element of the range is negative and out of range" # Expected RangeError (-4..3 out of range) but got: IndexError (offset -4 too small for struct(size:3))
14
+ fails "Struct#values_at when passed an integer Range returns an empty Array when Range is empty" # Exception: Cannot read properties of undefined (reading '$$is_number')
15
+ fails "Struct#values_at when passed an integer Range supports endless Range" # TypeError: cannot convert endless range to an array
16
+ fails "Struct#values_at when passed names slices captures with the given String names" # TypeError: no implicit conversion of String into Integer
17
+ fails "Struct#values_at when passed names slices captures with the given names" # TypeError: no implicit conversion of String into Integer
9
18
  fails "Struct.new keyword_init: true option raises when there is a duplicate member" # Expected ArgumentError (duplicate member: foo) but no exception was raised (#<Class:0x76a42> was returned)
10
19
  fails "Struct.new raises ArgumentError when there is a duplicate member" # Expected ArgumentError (duplicate member: foo) but no exception was raised (#<Class:0x769fa> was returned)
11
- fails "Struct.new raises a TypeError or ArgumentError if passed a Hash with an unknown key" # Expected StandardError but no exception was raised (#<Class:0x76a0a> was returned)
12
- fails "StructClass#keyword_init? returns nil for a struct that did not explicitly specify keyword_init" # Expected false to be nil
20
+ fails "StructClass#keyword_init? returns nil for a struct that did not explicitly specify keyword_init" # Expected false to be nil
21
+ fails "StructClass#keyword_init? returns true for any truthy value, not just for true" # Expected 1 to be true
13
22
  fails_badly "Struct#hash returns different hashes for different struct classes" # A failure in Chromium that once passes, other times it doesn't, most probably related to some kind of undeterminism.
14
23
  fails_badly "Struct#hash returns different hashes for structs with different values" # Ditto
24
+ fails_badly "Struct#values_at when passed an integer Range supports beginningless Range" # TypeError: cannot convert endless range to an array
15
25
  end