opal 1.1.1 → 1.2.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (108) hide show
  1. checksums.yaml +4 -4
  2. data/.codeclimate.yml +3 -2
  3. data/.github/ISSUE_TEMPLATE/bug-report.md +47 -0
  4. data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
  5. data/.github/workflows/build.yml +11 -5
  6. data/.gitignore +1 -0
  7. data/.jshintrc +1 -1
  8. data/Gemfile +0 -4
  9. data/HACKING.md +1 -1
  10. data/README.md +19 -15
  11. data/UNRELEASED.md +41 -0
  12. data/benchmark-ips/bm_array_unshift.rb +7 -0
  13. data/bin/opal-mspec +2 -0
  14. data/docs/compiler.md +1 -1
  15. data/examples/rack/Gemfile +0 -1
  16. data/examples/rack/Gemfile.lock +0 -4
  17. data/lib/opal/cli.rb +1 -0
  18. data/lib/opal/cli_options.rb +4 -0
  19. data/lib/opal/cli_runners/nodejs.rb +4 -0
  20. data/lib/opal/cli_runners/source-map-support-browser.js +3 -1
  21. data/lib/opal/cli_runners/source-map-support-node.js +3 -1
  22. data/lib/opal/cli_runners/source-map-support.js +3 -1
  23. data/lib/opal/compiler.rb +2 -2
  24. data/lib/opal/nodes/args/arity_check.rb +1 -0
  25. data/lib/opal/nodes/args/parameters.rb +6 -0
  26. data/lib/opal/nodes/class.rb +1 -13
  27. data/lib/opal/nodes/literal.rb +14 -7
  28. data/lib/opal/nodes/module.rb +13 -9
  29. data/lib/opal/nodes/variables.rb +13 -4
  30. data/lib/opal/nodes/while.rb +54 -17
  31. data/lib/opal/parser.rb +1 -5
  32. data/lib/opal/parser/patch.rb +34 -0
  33. data/lib/opal/repl.rb +7 -0
  34. data/lib/opal/rewriter.rb +2 -0
  35. data/lib/opal/rewriters/arguments.rb +4 -1
  36. data/lib/opal/rewriters/forward_args.rb +54 -0
  37. data/lib/opal/rewriters/logical_operator_assignment.rb +5 -2
  38. data/lib/opal/rewriters/opal_engine_check.rb +5 -7
  39. data/lib/opal/version.rb +1 -1
  40. data/opal/corelib/array.rb +42 -20
  41. data/opal/corelib/array/pack.rb +6 -1
  42. data/opal/corelib/complex.rb +2 -0
  43. data/opal/corelib/constants.rb +3 -3
  44. data/opal/corelib/hash.rb +36 -38
  45. data/opal/corelib/module.rb +2 -7
  46. data/opal/corelib/number.rb +2 -180
  47. data/opal/corelib/numeric.rb +156 -0
  48. data/opal/corelib/object_space.rb +102 -0
  49. data/opal/corelib/random.rb +31 -66
  50. data/opal/corelib/random/formatter.rb +122 -0
  51. data/opal/corelib/range.rb +50 -19
  52. data/opal/corelib/runtime.js +82 -21
  53. data/opal/corelib/string.rb +86 -52
  54. data/opal/corelib/string/encoding.rb +140 -25
  55. data/opal/corelib/string/unpack.rb +26 -40
  56. data/opal/opal.rb +1 -0
  57. data/opal/opal/full.rb +1 -0
  58. data/spec/filters/bugs/array.rb +0 -22
  59. data/spec/filters/bugs/basicobject.rb +3 -0
  60. data/spec/filters/bugs/encoding.rb +0 -2
  61. data/spec/filters/bugs/exception.rb +1 -0
  62. data/spec/filters/bugs/float.rb +0 -2
  63. data/spec/filters/bugs/hash.rb +2 -7
  64. data/spec/filters/bugs/integer.rb +0 -2
  65. data/spec/filters/bugs/kernel.rb +16 -3
  66. data/spec/filters/bugs/language.rb +6 -14
  67. data/spec/filters/bugs/marshal.rb +1 -3
  68. data/spec/filters/bugs/module.rb +16 -1
  69. data/spec/filters/bugs/numeric.rb +4 -12
  70. data/spec/filters/bugs/objectspace.rb +67 -0
  71. data/spec/filters/bugs/pack_unpack.rb +0 -9
  72. data/spec/filters/bugs/pathname.rb +1 -0
  73. data/spec/filters/bugs/proc.rb +8 -0
  74. data/spec/filters/bugs/random.rb +3 -6
  75. data/spec/filters/bugs/range.rb +83 -113
  76. data/spec/filters/bugs/set.rb +2 -0
  77. data/spec/filters/bugs/string.rb +31 -70
  78. data/spec/filters/bugs/struct.rb +2 -0
  79. data/spec/filters/bugs/time.rb +8 -2
  80. data/spec/filters/unsupported/float.rb +3 -0
  81. data/spec/filters/unsupported/freeze.rb +1 -0
  82. data/spec/filters/unsupported/integer.rb +3 -0
  83. data/spec/filters/unsupported/refinements.rb +5 -0
  84. data/spec/filters/unsupported/string.rb +100 -95
  85. data/spec/filters/unsupported/time.rb +4 -0
  86. data/spec/lib/compiler_spec.rb +16 -0
  87. data/spec/lib/rewriters/forward_args_spec.rb +61 -0
  88. data/spec/lib/rewriters/logical_operator_assignment_spec.rb +1 -1
  89. data/spec/lib/rewriters/numblocks_spec.rb +44 -0
  90. data/spec/lib/rewriters/opal_engine_check_spec.rb +49 -4
  91. data/spec/opal/core/language/forward_args_spec.rb +53 -0
  92. data/spec/opal/core/language/infinite_range_spec.rb +13 -0
  93. data/spec/opal/core/language/memoization_spec.rb +16 -0
  94. data/spec/opal/core/module_spec.rb +38 -2
  95. data/spec/opal/core/number/to_i_spec.rb +28 -0
  96. data/spec/opal/core/runtime/bridged_classes_spec.rb +16 -0
  97. data/spec/opal/core/runtime/constants_spec.rb +20 -1
  98. data/spec/opal/core/string/subclassing_spec.rb +16 -0
  99. data/spec/opal/core/string/unpack_spec.rb +22 -0
  100. data/spec/opal/core/string_spec.rb +4 -4
  101. data/spec/ruby_specs +4 -1
  102. data/stdlib/json.rb +3 -1
  103. data/stdlib/securerandom.rb +55 -35
  104. data/tasks/testing.rake +6 -3
  105. data/test/nodejs/test_string.rb +25 -0
  106. data/vendored-minitest/minitest/assertions.rb +2 -0
  107. metadata +31 -10
  108. data/lib/opal/parser/with_c_lexer.rb +0 -15
@@ -1,6 +1,7 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "Pathname" do
3
3
  fails "Pathname#/ appends a pathname to self" # NoMethodError: undefined method `/' for /usr
4
+ fails "Pathname#inspect returns a consistent String" # Expected "/tmp" == "#<Pathname:/tmp>" to be truthy but was false
4
5
  fails "Pathname#realdirpath returns a Pathname"
5
6
  fails "Pathname#realpath returns a Pathname"
6
7
  fails "Pathname#relative_path_from raises an error when the base directory has .."
@@ -7,6 +7,7 @@ opal_filter "Proc" do
7
7
  fails "Proc#== is a public method" # Expected Proc to have public instance method '==' but it does not
8
8
  fails "Proc#== returns true if other is a dup of the original" # Expected false to be true
9
9
  fails "Proc#=== can call its block argument declared with a block argument" # Expected 6 to equal 10
10
+ fails "Proc#=== on a Proc created with Kernel#lambda or Kernel#proc ignores excess arguments when self is a proc" # ArgumentError: expected kwargs
10
11
  fails "Proc#=== yields to the block given at declaration and not to the block argument" # Expected 3 to equal 7
11
12
  fails "Proc#>> composition is a lambda when self is lambda" # NoMethodError: undefined method `>>' for #<Proc:0x76126>
12
13
  fails "Proc#>> does not try to coerce argument with #to_proc" # Expected TypeError (callable object is expected) but got: NoMethodError (undefined method `>>' for #<Proc:0x76108>)
@@ -22,6 +23,7 @@ opal_filter "Proc" do
22
23
  fails "Proc#binding returns a Binding instance"
23
24
  fails "Proc#binding returns the binding associated with self"
24
25
  fails "Proc#call can call its block argument declared with a block argument" # Expected 6 to equal 10
26
+ fails "Proc#call on a Proc created with Kernel#lambda or Kernel#proc ignores excess arguments when self is a proc" # ArgumentError: expected kwargs
25
27
  fails "Proc#call yields to the block given at declaration and not to the block argument" # Expected 3 to equal 7
26
28
  fails "Proc#curry with arity argument returns Procs with arities of -1 regardless of the value of _arity_"
27
29
  fails "Proc#curry with arity argument returns a Proc if called on a lambda that requires fewer than _arity_ arguments but may take more" # ArgumentError: wrong number of arguments (4 for 5)
@@ -41,6 +43,11 @@ opal_filter "Proc" do
41
43
  fails "Proc#inspect for a proc created with proc returns a description including file and line number" # Expected "#<Proc:0x25a>" =~ /^#<Proc:([^ ]*?)@ruby\/core\/proc\/shared\/to_s\.rb:26>$/ to be truthy but was nil
42
44
  fails "Proc#lambda? is preserved when passing a Proc with & to the lambda keyword"
43
45
  fails "Proc#lambda? is preserved when passing a Proc with & to the proc keyword"
46
+ fails "Proc#ruby2_keywords marks the final hash argument as keyword hash" # NoMethodError: undefined method `ruby2_keywords' for #<Proc:0x36616>
47
+ fails "Proc#ruby2_keywords prints warning when a proc accepts keyword splat" # NoMethodError: undefined method `ruby2_keywords' for #<Proc:0x365fe>
48
+ fails "Proc#ruby2_keywords prints warning when a proc accepts keywords" # NoMethodError: undefined method `ruby2_keywords' for #<Proc:0x36612>
49
+ fails "Proc#ruby2_keywords prints warning when a proc does not accept argument splat" # NoMethodError: undefined method `ruby2_keywords' for #<Proc:0x3660a>
50
+ fails "Proc#ruby2_keywords returns self" # NoMethodError: undefined method `ruby2_keywords' for #<Proc:0x36602>
44
51
  fails "Proc#source_location returns an Array"
45
52
  fails "Proc#source_location returns the first line of a multi-line proc (i.e. the line containing 'proc do')"
46
53
  fails "Proc#source_location returns the location of the proc's body; not necessarily the proc itself"
@@ -62,6 +69,7 @@ opal_filter "Proc" do
62
69
  fails "Proc#to_s for a proc created with proc has a binary encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
63
70
  fails "Proc#to_s for a proc created with proc returns a description including file and line number" # Expected "#<Proc:0x17d18>" =~ /^#<Proc:([^ ]*?)@ruby\/core\/proc\/shared\/to_s\.rb:26>$/ to be truthy but was nil
64
71
  fails "Proc#yield can call its block argument declared with a block argument" # Expected 6 to equal 10
72
+ fails "Proc#yield on a Proc created with Kernel#lambda or Kernel#proc ignores excess arguments when self is a proc" # ArgumentError: expected kwargs
65
73
  fails "Proc#yield yields to the block given at declaration and not to the block argument" # Expected 3 to equal 7
66
74
  fails "Proc.allocate raises a TypeError"
67
75
  fails "Proc.new with a block argument called indirectly from a subclass returns the passed proc created from a block"
@@ -3,12 +3,6 @@ opal_filter "Random" do
3
3
  fails "Random#bytes returns the same numeric output for a given huge seed across all implementations and platforms" # Expected "z­" to equal "_\u0091"
4
4
  fails "Random#bytes returns the same numeric output for a given seed across all implementations and platforms" # Expected "ÚG" to equal "\u0014\\"
5
5
  fails "Random#rand with Range supports custom object types" # Expected "NaN#<struct RandomSpecs::CustomRangeInteger value=1>" (String) to be an instance of RandomSpecs::CustomRangeInteger
6
- fails "Random.bytes returns a String of the length given as argument" # NoMethodError: undefined method `bytes' for Random
7
- fails "Random.bytes returns a String" # NoMethodError: undefined method `bytes' for Random
8
- fails "Random.bytes returns a binary String" # NoMethodError: undefined method `bytes' for Random
9
- fails "Random.bytes returns a random binary String" # NoMethodError: undefined method `bytes' for Random
10
- fails "Random.random_number returns a Float if no max argument is passed" # NoMethodError: undefined method `random_number' for #<Random:0x12e>
11
- fails "Random.random_number returns an Integer if an Integer argument is passed" # NoMethodError: undefined method `random_number' for #<Random:0x12e>
12
6
  fails "Random.raw_seed raises an ArgumentError on a negative size" # NoMethodError: undefined method `raw_seed' for Random
13
7
  fails "Random.raw_seed returns a String of the length given as argument" # NoMethodError: undefined method `raw_seed' for Random
14
8
  fails "Random.raw_seed returns a String" # NoMethodError: undefined method `raw_seed' for Random
@@ -17,4 +11,7 @@ opal_filter "Random" do
17
11
  fails "Random::DEFAULT changes seed on reboot" # NoMethodError: undefined method `insert' for "rubyexe.rb"
18
12
  fails "Random::DEFAULT is deprecated" # Expected #<Random:0x3e>.equal? Random to be truthy but was false
19
13
  fails "Random::DEFAULT refers to the Random class" # Expected #<Random:0x3e>.equal? Random to be truthy but was false
14
+ fails "SecureRandom.random_number generates a random float number between 0.0 and 1.0 if argument is negative float" # ArgumentError: invalid argument - -11.1
15
+ fails "SecureRandom.random_number generates a random float number between 0.0 and 1.0 if argument is negative" # ArgumentError: invalid argument - -10
16
+ fails "SecureRandom.random_number raises ArgumentError if the argument is non-numeric" # Expected ArgumentError but got: TypeError (no implicit conversion of Object into Integer)
20
17
  end
@@ -2,138 +2,108 @@
2
2
  opal_filter "Range" do
3
3
  fails "Range#% produces an arithmetic sequence with a percent sign in #inspect" # NoMethodError: undefined method `%' for 1..10
4
4
  fails "Range#% works as a Range#step" # NoMethodError: undefined method `%' for 1..10
5
- fails "Range#== returns true if the endpoints are == for beginless ranges" # Opal::SyntaxError: undefined method `type' for nil
6
- fails "Range#== returns true if the endpoints are == for endless ranges" # Opal::SyntaxError: undefined method `type' for nil
7
- fails "Range#== works for endless Ranges" # Opal::SyntaxError: undefined method `type' for nil
8
- fails "Range#=== requires #succ method to be implemented" # Expected TypeError (/can't iterate from/) but no exception was raised (true was returned)
9
- fails "Range#=== returns true if other is an element of self for endless ranges" # Opal::SyntaxError: undefined method `type' for nil
10
- fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers accepts (+/-)Float::INFINITY from the block"
5
+ fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers accepts (+/-)Float::INFINITY from the block" # TypeError: can't iterate from Float
11
6
  fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns a boundary element if appropriate" # NoMethodError: undefined method `prev_float' for 3
12
7
  fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0 (small numbers)" # TypeError: can't iterate from Float
13
- fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0"
14
- fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns nil if the block never returns zero"
15
- fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element"
16
- fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element"
17
- fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers works with infinity bounds" # TypeError: can't iterate from Float
8
+ fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # TypeError: can't iterate from Float
9
+ fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # TypeError: can't iterate from Float
10
+ fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # TypeError: can't iterate from Float
11
+ fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # TypeError: can't iterate from Float
12
+ fails "Range#bsearch with Float values with a block returning negative, zero, positive numbers works with infinity bounds" # NotImplementedError: Can't #bsearch an infinite range
18
13
  fails "Range#bsearch with Float values with a block returning true or false returns a boundary element if appropriate" # NoMethodError: undefined method `prev_float' for 3
19
- fails "Range#bsearch with Float values with a block returning true or false returns minimum element if the block returns true for every element"
20
- fails "Range#bsearch with Float values with a block returning true or false returns nil if the block returns false for every element"
21
- fails "Range#bsearch with Float values with a block returning true or false returns nil if the block returns nil for every element"
22
- fails "Range#bsearch with Float values with a block returning true or false returns the smallest element for which block returns true"
23
- fails "Range#bsearch with Float values with a block returning true or false works with infinity bounds" # TypeError: can't iterate from Float
24
- fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers accepts (+/-)Float::INFINITY from the block" # Opal::SyntaxError: undefined method `type' for nil
25
- fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # Opal::SyntaxError: undefined method `type' for nil
26
- fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # Opal::SyntaxError: undefined method `type' for nil
27
- fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # Opal::SyntaxError: undefined method `type' for nil
28
- fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # Opal::SyntaxError: undefined method `type' for nil
29
- fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # Opal::SyntaxError: undefined method `type' for nil
30
- fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers works with infinity bounds" # Opal::SyntaxError: undefined method `type' for nil
31
- fails "Range#bsearch with beginless ranges and Float values with a block returning true or false returns nil if the block returns nil for every element" # Opal::SyntaxError: undefined method `type' for nil
32
- fails "Range#bsearch with beginless ranges and Float values with a block returning true or false returns nil if the block returns true for every element" # Opal::SyntaxError: undefined method `type' for nil
33
- fails "Range#bsearch with beginless ranges and Float values with a block returning true or false returns the smallest element for which block returns true" # Opal::SyntaxError: undefined method `type' for nil
34
- fails "Range#bsearch with beginless ranges and Float values with a block returning true or false works with infinity bounds" # Opal::SyntaxError: undefined method `type' for nil
35
- fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers accepts Float::INFINITY from the block" # Opal::SyntaxError: undefined method `type' for nil
36
- fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # Opal::SyntaxError: undefined method `type' for nil
37
- fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # Opal::SyntaxError: undefined method `type' for nil
38
- fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # Opal::SyntaxError: undefined method `type' for nil
39
- fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # Opal::SyntaxError: undefined method `type' for nil
40
- fails "Range#bsearch with beginless ranges and Integer values with a block returning true or false returns the smallest element for which block returns true" # Opal::SyntaxError: undefined method `type' for nil
41
- fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers accepts (+/-)Float::INFINITY from the block" # Opal::SyntaxError: undefined method `type' for nil
42
- fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # Opal::SyntaxError: undefined method `type' for nil
43
- fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # Opal::SyntaxError: undefined method `type' for nil
44
- fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # Opal::SyntaxError: undefined method `type' for nil
45
- fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # Opal::SyntaxError: undefined method `type' for nil
46
- fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # Opal::SyntaxError: undefined method `type' for nil
47
- fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers works with infinity bounds" # Opal::SyntaxError: undefined method `type' for nil
48
- fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns minimum element if the block returns true for every element" # Opal::SyntaxError: undefined method `type' for nil
49
- fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns nil if the block returns false for every element" # Opal::SyntaxError: undefined method `type' for nil
50
- fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns nil if the block returns nil for every element" # Opal::SyntaxError: undefined method `type' for nil
51
- fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns the smallest element for which block returns true" # Opal::SyntaxError: undefined method `type' for nil
52
- fails "Range#bsearch with endless ranges and Float values with a block returning true or false works with infinity bounds" # Opal::SyntaxError: undefined method `type' for nil
53
- fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers accepts -Float::INFINITY from the block" # Opal::SyntaxError: undefined method `type' for nil
54
- fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # Opal::SyntaxError: undefined method `type' for nil
55
- fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # Opal::SyntaxError: undefined method `type' for nil
56
- fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # Opal::SyntaxError: undefined method `type' for nil
57
- fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # Opal::SyntaxError: undefined method `type' for nil
58
- fails "Range#bsearch with endless ranges and Integer values with a block returning true or false returns minimum element if the block returns true for every element" # Opal::SyntaxError: undefined method `type' for nil
59
- fails "Range#bsearch with endless ranges and Integer values with a block returning true or false returns the smallest element for which block returns true" # Opal::SyntaxError: undefined method `type' for nil
60
- fails "Range#count returns Infinity for beginless ranges without arguments or blocks" # Opal::SyntaxError: undefined method `type' for nil
14
+ fails "Range#bsearch with Float values with a block returning true or false returns minimum element if the block returns true for every element" # TypeError: can't iterate from Float
15
+ fails "Range#bsearch with Float values with a block returning true or false returns nil if the block returns false for every element" # TypeError: can't iterate from Float
16
+ fails "Range#bsearch with Float values with a block returning true or false returns nil if the block returns nil for every element" # TypeError: can't iterate from Float
17
+ fails "Range#bsearch with Float values with a block returning true or false returns the smallest element for which block returns true" # TypeError: can't iterate from Float
18
+ fails "Range#bsearch with Float values with a block returning true or false works with infinity bounds" # NotImplementedError: Can't #bsearch an infinite range
19
+ fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers accepts (+/-)Float::INFINITY from the block" # NotImplementedError: Can't #bsearch an infinite range
20
+ fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # NotImplementedError: Can't #bsearch an infinite range
21
+ fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # NotImplementedError: Can't #bsearch an infinite range
22
+ fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # NotImplementedError: Can't #bsearch an infinite range
23
+ fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
24
+ fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
25
+ fails "Range#bsearch with beginless ranges and Float values with a block returning negative, zero, positive numbers works with infinity bounds" # NoMethodError: undefined method `inf' for #<MSpecEnv:0x1b536>
26
+ fails "Range#bsearch with beginless ranges and Float values with a block returning true or false returns nil if the block returns nil for every element" # NotImplementedError: Can't #bsearch an infinite range
27
+ fails "Range#bsearch with beginless ranges and Float values with a block returning true or false returns nil if the block returns true for every element" # NotImplementedError: Can't #bsearch an infinite range
28
+ fails "Range#bsearch with beginless ranges and Float values with a block returning true or false returns the smallest element for which block returns true" # NotImplementedError: Can't #bsearch an infinite range
29
+ fails "Range#bsearch with beginless ranges and Float values with a block returning true or false works with infinity bounds" # NoMethodError: undefined method `inf' for #<MSpecEnv:0x1b536>
30
+ fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers accepts Float::INFINITY from the block" # NotImplementedError: Can't #bsearch an infinite range
31
+ fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # NotImplementedError: Can't #bsearch an infinite range
32
+ fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # NotImplementedError: Can't #bsearch an infinite range
33
+ fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # NotImplementedError: Can't #bsearch an infinite range
34
+ fails "Range#bsearch with beginless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
35
+ fails "Range#bsearch with beginless ranges and Integer values with a block returning true or false returns the smallest element for which block returns true" # NotImplementedError: Can't #bsearch an infinite range
36
+ fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers accepts (+/-)Float::INFINITY from the block" # NotImplementedError: Can't #bsearch an infinite range
37
+ fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # NotImplementedError: Can't #bsearch an infinite range
38
+ fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # NotImplementedError: Can't #bsearch an infinite range
39
+ fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # NotImplementedError: Can't #bsearch an infinite range
40
+ fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns greater than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
41
+ fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
42
+ fails "Range#bsearch with endless ranges and Float values with a block returning negative, zero, positive numbers works with infinity bounds" # NoMethodError: undefined method `inf' for #<MSpecEnv:0x1b536>
43
+ fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns minimum element if the block returns true for every element" # NotImplementedError: Can't #bsearch an infinite range
44
+ fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns nil if the block returns false for every element" # NotImplementedError: Can't #bsearch an infinite range
45
+ fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns nil if the block returns nil for every element" # NotImplementedError: Can't #bsearch an infinite range
46
+ fails "Range#bsearch with endless ranges and Float values with a block returning true or false returns the smallest element for which block returns true" # NotImplementedError: Can't #bsearch an infinite range
47
+ fails "Range#bsearch with endless ranges and Float values with a block returning true or false works with infinity bounds" # NoMethodError: undefined method `inf' for #<MSpecEnv:0x1b536>
48
+ fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers accepts -Float::INFINITY from the block" # NotImplementedError: Can't #bsearch an infinite range
49
+ fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0" # NotImplementedError: Can't #bsearch an infinite range
50
+ fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns an element at an index for which block returns 0.0" # NotImplementedError: Can't #bsearch an infinite range
51
+ fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block never returns zero" # NotImplementedError: Can't #bsearch an infinite range
52
+ fails "Range#bsearch with endless ranges and Integer values with a block returning negative, zero, positive numbers returns nil if the block returns less than zero for every element" # NotImplementedError: Can't #bsearch an infinite range
53
+ fails "Range#bsearch with endless ranges and Integer values with a block returning true or false returns minimum element if the block returns true for every element" # NotImplementedError: Can't #bsearch an infinite range
54
+ fails "Range#bsearch with endless ranges and Integer values with a block returning true or false returns the smallest element for which block returns true" # NotImplementedError: Can't #bsearch an infinite range
55
+ fails "Range#cover? accepts beginless range argument" # Expected false to be true
56
+ fails "Range#cover? accepts endless range argument" # Expected false to be true
57
+ fails "Range#cover? allows self to be a beginless range" # Expected false to be true
58
+ fails "Range#cover? allows self to be a endless range" # Expected false to be true
61
59
  fails "Range#cover? range argument accepts range argument" # Expected false to be true
62
60
  fails "Range#cover? range argument honors exclusion of right boundary (:exclude_end option)" # Expected false to be true
63
61
  fails "Range#cover? range argument supports boundaries of different comparable types" # Expected false to be true
64
- fails "Range#cover? returns true if other is an element of self for endless ranges" # Opal::SyntaxError: undefined method `type' for nil
65
- fails "Range#each raises a TypeError beginless ranges" # Expected TypeError but got: Opal::SyntaxError (undefined method `type' for nil)
66
- fails "Range#each raises a TypeError if the first element is a Time object"
67
- fails "Range#each works with String endless ranges" # Opal::SyntaxError: undefined method `type' for nil
68
- fails "Range#each works with endless ranges" # Opal::SyntaxError: undefined method `type' for nil
69
- fails "Range#eql? returns false if the endpoints are not eql?"
70
- fails "Range#eql? works for endless Ranges" # Opal::SyntaxError: undefined method `type' for nil
71
- fails "Range#first raises a RangeError when called on an beginless range" # Expected RangeError but got: Opal::SyntaxError (undefined method `type' for nil)
72
- fails "Range#first raises a TypeError if #to_int does not return an Integer"
73
- fails "Range#hash generates a Fixnum for the hash value"
62
+ fails "Range#each raises a TypeError if the first element is a Time object" # Expected TypeError but no exception was raised (2021-01-02 22:49:45 +0100..2021-01-02 22:49:46 +0100 was returned)
63
+ fails "Range#eql? returns false if the endpoints are not eql?" # Expected 0..1 not to have same value or type as 0..1
64
+ fails "Range#first raises a TypeError if #to_int does not return an Integer" # Expected TypeError but no exception was raised ([2] was returned)
74
65
  fails "Range#hash generates an Integer for the hash value" # Expected "A,1,1,0" (String) to be an instance of Integer
75
66
  fails "Range#include? on string elements returns false if other is not matched by element.succ" # Expected true to be false
76
- fails "Range#include? returns true if other is an element of self for endless ranges" # Opal::SyntaxError: undefined method `type' for nil
77
67
  fails "Range#include? with weird succ when excluded end value returns false if other is not matched by element.succ" # Expected true to be false
78
68
  fails "Range#include? with weird succ when included end value returns false if other is equal as last element but not matched by element.succ" # Expected true to be false
79
69
  fails "Range#include? with weird succ when included end value returns false if other is not matched by element.succ" # Expected true to be false
80
70
  fails "Range#initialize raises a FrozenError if called on an already initialized Range" # Expected FrozenError but got: NameError ('initialize' called twice)
81
- fails "Range#inspect works for beginless ranges" # Opal::SyntaxError: undefined method `type' for nil
82
- fails "Range#inspect works for endless ranges" # Opal::SyntaxError: undefined method `type' for nil
83
- fails "Range#inspect works for nil ... nil ranges" # Opal::SyntaxError: undefined method `type' for nil
84
- fails "Range#last raises a RangeError when called on an endless range" # Expected RangeError but got: Opal::SyntaxError (undefined method `type' for nil)
85
- fails "Range#last raises a TypeError if #to_int does not return an Integer"
86
- fails "Range#max given a block calls #> and #< on the return value of the block"
87
- fails "Range#max given a block raises RangeError when called with custom comparison method on an beginless range" # Expected RangeError but got: Opal::SyntaxError (undefined method `type' for nil)
88
- fails "Range#max raises RangeError when called on an endless range" # Expected RangeError but got: Opal::SyntaxError (undefined method `type' for nil)
89
- fails "Range#max raises TypeError when called on a Time...Time(excluded end point)"
90
- fails "Range#max raises TypeError when called on an exclusive range and a non Integer value"
91
- fails "Range#max raises for an exclusive beginless range" # Expected TypeError (cannot exclude end value with non Integer begin value) but got: Opal::SyntaxError (undefined method `type' for nil)
92
- fails "Range#max returns the end point for beginless ranges" # Opal::SyntaxError: undefined method `type' for nil
93
- fails "Range#max returns the maximum value in the range when called with no arguments"
94
- fails "Range#member? on string elements returns false if other is not matched by element.succ"
95
- fails "Range#member? returns true if other is an element of self for endless ranges" # Opal::SyntaxError: undefined method `type' for nil
96
- fails "Range#member? with weird succ when excluded end value returns false if other is not matched by element.succ"
97
- fails "Range#member? with weird succ when included end value returns false if other is equal as last element but not matched by element.succ"
98
- fails "Range#member? with weird succ when included end value returns false if other is not matched by element.succ"
99
- fails "Range#min given a block calls #> and #< on the return value of the block"
100
- fails "Range#min given a block raises RangeError when called with custom comparison method on an endless range" # Expected RangeError but got: Opal::SyntaxError (undefined method `type' for nil)
101
- fails "Range#min raises RangeError when called on an beginless range" # Expected RangeError but got: Opal::SyntaxError (undefined method `type' for nil)
102
- fails "Range#min returns the start point for endless ranges" # Opal::SyntaxError: undefined method `type' for nil
71
+ fails "Range#inspect works for nil ... nil ranges" # Expected ".." == "nil..nil" to be truthy but was false
72
+ fails "Range#last raises a TypeError if #to_int does not return an Integer" # Expected TypeError but no exception was raised ([3] was returned)
73
+ fails "Range#max given a block calls #> and #< on the return value of the block" # Mock 'obj' expected to receive >("any_args") exactly 2 times but received it 0 times
74
+ fails "Range#max given a block raises RangeError when called with custom comparison method on an beginless range" # Expected RangeError but got: TypeError (can't iterate from NilClass)
75
+ fails "Range#max raises TypeError when called on a Time...Time(excluded end point)" # Expected TypeError but no exception was raised (1609624185562 was returned)
76
+ fails "Range#max raises TypeError when called on an exclusive range and a non Integer value" # Expected TypeError but no exception was raised (907.1111 was returned)
77
+ fails "Range#max raises for an exclusive beginless range" # Expected TypeError (cannot exclude end value with non Integer begin value) but no exception was raised (0 was returned)
78
+ fails "Range#max returns the maximum value in the range when called with no arguments" # Expected NaN == "e" to be truthy but was false
79
+ fails "Range#member? on string elements returns false if other is not matched by element.succ" # Expected true to be false
80
+ fails "Range#member? with weird succ when excluded end value returns false if other is not matched by element.succ" # Expected true to be false
81
+ fails "Range#member? with weird succ when included end value returns false if other is equal as last element but not matched by element.succ" # Expected true to be false
82
+ fails "Range#member? with weird succ when included end value returns false if other is not matched by element.succ" # Expected true to be false
83
+ fails "Range#min given a block calls #> and #< on the return value of the block" # Mock 'obj' expected to receive >("any_args") exactly 2 times but received it 0 times
103
84
  fails "Range#minmax on an exclusive range raises TypeError if the end value is not an integer" # Expected TypeError (cannot exclude non Integer end value) but got: TypeError (can't iterate from Float)
104
- fails "Range#minmax on an exclusive range should raise RangeError on a beginless range" # ArgumentError: bad value for range
85
+ fails "Range#minmax on an exclusive range should raise RangeError on a beginless range" # Expected RangeError (/cannot get the maximum of beginless range with custom comparison method|cannot get the minimum of beginless range/) but got: TypeError (can't iterate from NilClass)
105
86
  fails "Range#minmax on an exclusive range should raise RangeError on an endless range" # Mock 'x': method <=> called with unexpected arguments (nil)
106
- fails "Range#minmax on an inclusive range raises RangeError or ArgumentError on a beginless range" # ArgumentError: bad value for range
87
+ fails "Range#minmax on an inclusive range raises RangeError or ArgumentError on a beginless range" # Expected ArgumentError (comparison of NilClass with MockObject failed) but got: TypeError (can't iterate from NilClass)
107
88
  fails "Range#minmax on an inclusive range should raise RangeError on an endless range without iterating the range" # Mock 'x': method <=> called with unexpected arguments (nil)
108
89
  fails "Range#minmax on an inclusive range should return the minimum and maximum values for a non-numeric range without iterating the range" # Mock 'x' expected to receive succ("any_args") exactly 0 times but received it 1 times
109
90
  fails "Range#minmax on an inclusive range should return the minimum and maximum values for a numeric range without iterating the range" # TypeError: can't iterate from Float
110
- fails "Range#size returns Float::INFINITY for all beginless ranges" # Opal::SyntaxError: undefined method `type' for nil
111
- fails "Range#size returns Float::INFINITY for endless ranges if the start is numeric" # Opal::SyntaxError: undefined method `type' for nil
112
- fails "Range#size returns nil for endless ranges if the start is not numeric" # Opal::SyntaxError: undefined method `type' for nil
91
+ fails "Range#size returns nil for endless ranges if the start is not numeric" # Expected Infinity == nil to be truthy but was false
113
92
  fails "Range#step when no block is given raises an ArgumentError if step is 0" # Expected ArgumentError but no exception was raised (#<Enumerator: -1..1:step(0)> was returned)
114
- fails "Range#step when no block is given returned Enumerator size raises a TypeError if #to_int does not return an Integer" # Expected TypeError but no exception was raised (#<Enumerator: 1..2:step(#<MockObject:0x13494>)> was returned)
115
- fails "Range#step when no block is given returned Enumerator size raises a TypeError if step does not respond to #to_int" # Expected TypeError but no exception was raised (#<Enumerator: 1..2:step(#<MockObject:0x13478>)> was returned)
93
+ fails "Range#step when no block is given returned Enumerator size raises a TypeError if #to_int does not return an Integer" # Expected TypeError but no exception was raised (#<Enumerator: 1..2:step(#<MockObject:0x2d238>)> was returned)
94
+ fails "Range#step when no block is given returned Enumerator size raises a TypeError if step does not respond to #to_int" # Expected TypeError but no exception was raised (#<Enumerator: 1..2:step(#<MockObject:0x2d214>)> was returned)
116
95
  fails "Range#step when no block is given returned Enumerator size returns the ceil of range size divided by the number of steps even if step is negative" # ArgumentError: step can't be negative
117
96
  fails "Range#step when no block is given returned Enumerator type when both begin and end are numerics returns an instance of Enumerator::ArithmeticSequence" # Expected Enumerator == Enumerator::ArithmeticSequence to be truthy but was false
118
- fails "Range#step with an endless range and Float values handles infinite values at the start" # Opal::SyntaxError: undefined method `type' for nil
119
- fails "Range#step with an endless range and Float values yields Float values incremented by 1 and less than end when not passed a step" # Opal::SyntaxError: undefined method `type' for nil
120
- fails "Range#step with an endless range and Float values yields Float values incremented by a Float step" # Opal::SyntaxError: undefined method `type' for nil
121
- fails "Range#step with an endless range and Float values yields Float values incremented by an Integer step" # Opal::SyntaxError: undefined method `type' for nil
122
- fails "Range#step with an endless range and Integer values yield Integer values incremented by 1 when not passed a step" # Opal::SyntaxError: undefined method `type' for nil
123
- fails "Range#step with an endless range and Integer values yields Float values incremented by a Float step" # Opal::SyntaxError: undefined method `type' for nil
124
- fails "Range#step with an endless range and Integer values yields Integer values incremented by an Integer step" # Opal::SyntaxError: undefined method `type' for nil
125
- fails "Range#step with an endless range and String values raises a TypeError when passed a Float step" # Expected TypeError but got: Opal::SyntaxError (undefined method `type' for nil)
126
- fails "Range#step with an endless range and String values yields String values incremented by #succ and less than or equal to end when not passed a step" # Opal::SyntaxError: undefined method `type' for nil
127
- fails "Range#step with an endless range and String values yields String values incremented by #succ called Integer step times" # Opal::SyntaxError: undefined method `type' for nil
128
- fails "Range#step with exclusive end and Float values returns Float values of 'step * n + begin < end'" # precision errors
129
- fails "Range#step with exclusive end and String values raises a TypeError when passed a Float step" # requires Fixnum != Float
130
- fails "Range#step with inclusive end and Float values returns Float values of 'step * n + begin <= end'" # precision errors
131
- fails "Range#step with inclusive end and String values raises a TypeError when passed a Float step" # requires Fixnum != Float
132
- fails "Range#to_a throws an exception for beginless ranges" # Expected TypeError but got: Opal::SyntaxError (undefined method `type' for nil)
133
- fails "Range#to_a throws an exception for endless ranges" # Expected RangeError but got: Opal::SyntaxError (undefined method `type' for nil)
134
- fails "Range#to_s can show endless ranges" # Opal::SyntaxError: undefined method `type' for nil
135
- fails "Range.new beginless/endless range allows beginless left boundary" # ArgumentError: bad value for range
136
- fails "Range.new beginless/endless range allows endless right boundary" # ArgumentError: bad value for range
137
- fails "Range.new beginless/endless range distinguishes ranges with included and excluded right boundary" # ArgumentError: bad value for range
97
+ fails "Range#step with an endless range and Float values yields Float values incremented by a Float step" # Expected [-1, 0] to have same value and type as [-1, -0.5, 0, 0.5]
98
+ fails "Range#step with an endless range and Integer values yields Float values incremented by a Float step" # Expected [-2, 1] to have same value and type as [-2, -0.5, 1]
99
+ fails "Range#step with exclusive end and String values raises a TypeError when passed a Float step" # Expected TypeError but no exception was raised ("A"..."G" was returned)
100
+ fails "Range#step with inclusive end and Float values returns Float values of 'step * n + begin <= end'" # Expected [1, 2.8, 4.6, 6.4, 1, 2.3, 3.6, 4.9, 6.2, 7.5, 8.8, 10.1, 11.4] to have same value and type as [1, 2.8, 4.6, 6.4, 1, 2.3, 3.6, 4.9, 6.2, 7.5, 8.8, 10.1, 11.4, 12.7]
101
+ fails "Range#step with inclusive end and String values raises a TypeError when passed a Float step" # Expected TypeError but no exception was raised ("A".."G" was returned)
102
+ fails "Range#to_a throws an exception for endless ranges" # Expected RangeError but got: TypeError (cannot convert endless range to an array)
103
+ fails "Range#to_a works with Ranges of 64-bit integers" # Expected [256, 257] == [1099511627776, 1099511627777] to be truthy but was false
104
+ fails "Range#to_s can show beginless ranges" # Expected "...1" == "...1.0" to be truthy but was false
105
+ fails "Range#to_s can show endless ranges" # Expected "1..." == "1.0..." to be truthy but was false
106
+ fails_badly "Range#min given a block raises RangeError when called with custom comparison method on an endless range" # Expected RangeError but got: Opal::SyntaxError (undefined method `type' for nil)
138
107
  fails_badly "Range#minmax on an exclusive range should return the minimum and maximum values for a numeric range without iterating the range"
108
+ fails_badly "Range#step with an endless range and String values raises a TypeError when passed a Float step" # Expected TypeError but got: Opal::SyntaxError (undefined method `type' for nil)
139
109
  end
@@ -40,6 +40,8 @@ opal_filter "Set" do
40
40
  fails "Set#flatten_merge flattens the passed Set and merges it into self"
41
41
  fails "Set#flatten_merge raises an ArgumentError when trying to flatten a recursive Set"
42
42
  fails "Set#hash is static"
43
+ fails "Set#initialize uses #each on the provided Enumerable if it does not respond to #each_entry" # ArgumentError: value must be enumerable
44
+ fails "Set#initialize uses #each_entry on the provided Enumerable" # ArgumentError: value must be enumerable
43
45
  fails "Set#inspect correctly handles self-references"
44
46
  fails "Set#intersection raises an ArgumentError when passed a non-Enumerable"
45
47
  fails "Set#intersection returns a new Set containing only elements shared by self and the passed Enumerable"
@@ -1,5 +1,6 @@
1
1
  # NOTE: run bin/format-filters after changing this file
2
2
  opal_filter "String" do
3
+ fails "Integer#chr with an encoding argument accepts a String as an argument" # Expected to not get Exception but got: ArgumentError (unknown encoding name - euc-jp)
3
4
  fails "String#% can produce a string with invalid encoding" # Expected true to be false
4
5
  fails "String#% flags # applies to format o does nothing for negative argument" # Expected "0..7651" to equal "..7651"
5
6
  fails "String#% flags # applies to formats aAeEfgG changes format from dd.dddd to exponential form for gG" # Expected "1.234e+02" to equal "1.e+02"
@@ -34,6 +35,7 @@ opal_filter "String" do
34
35
  fails "String#% integer formats i works well with large numbers" # Expected "1234567890987654400" to equal "1234567890987654321"
35
36
  fails "String#% integer formats u works well with large numbers" # Expected "1234567890987654400" to equal "1234567890987654321"
36
37
  fails "String#% other formats % alone raises an ArgumentError" # Expected ArgumentError but no exception was raised ("%" was returned)
38
+ fails "String#% other formats s preserves encoding of the format string" # Expected #<Encoding:UTF-8> == #<Encoding:US-ASCII> to be truthy but was false
37
39
  fails "String#% output's encoding is the same as the format string if passed value is encoding-compatible" # NameError: uninitialized constant Encoding::SHIFT_JIS
38
40
  fails "String#% output's encoding raises if a compatible encoding can't be found" # Expected Encoding::CompatibilityError but no exception was raised ("hello world" was returned)
39
41
  fails "String#% precision float types controls the number of decimal places displayed in fraction part" # NotImplementedError: `A` and `a` format field types are not implemented in Opal yet
@@ -46,18 +48,27 @@ opal_filter "String" do
46
48
  fails "String#% width specifies the minimum number of characters that will be written to the result" # Expected " 1.095200e+02" to equal " 1.095200e+02"
47
49
  fails "String#* raises a RangeError when given integer is a Bignum" # Expected RangeError but no exception was raised ("" was returned)
48
50
  fails "String#* returns String instances" # Expected "" (MyString) to be an instance of String
49
- fails "String#+ when self is BINARY and argument is US-ASCII uses BINARY encoding" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
51
+ fails "String#+ when self and the argument are in different ASCII-compatible encodings raises Encoding::CompatibilityError if neither are ASCII-only" # Expected Encoding::CompatibilityError but no exception was raised ("éé" was returned)
52
+ fails "String#+ when self and the argument are in different ASCII-compatible encodings uses self's encoding if both are ASCII-only" # ArgumentError: unknown encoding name - SHIFT_JIS
53
+ fails "String#+ when self and the argument are in different ASCII-compatible encodings uses the argument's encoding if self is ASCII-only" # Expected #<Encoding:UTF-8> == #<Encoding:ISO-8859-1> to be truthy but was false
54
+ fails "String#+ when self is in an ASCII-incompatible encoding incompatible with the argument's encoding raises Encoding::CompatibilityError if neither are empty" # Expected Encoding::CompatibilityError but no exception was raised ("xy" was returned)
55
+ fails "String#+ when the argument is in an ASCII-incompatible encoding incompatible with self's encoding raises Encoding::CompatibilityError if neither are empty" # Expected Encoding::CompatibilityError but no exception was raised ("xy" was returned)
50
56
  fails "String#-@ does not deduplicate already frozen strings" # Expected "this string is frozen" not to be identical to "this string is frozen"
51
57
  fails "String#-@ does not deduplicate strings with additional instance variables" # NoMethodError: undefined method `-@' for "this string is frozen"
52
58
  fails "String#-@ does not deduplicate tainted strings" # NoMethodError: undefined method `-@' for "this string is frozen"
53
59
  fails "String#-@ returns the same object for equal unfrozen strings" # Expected "this is a string" not to be identical to "this is a string"
54
- fails "String#-@ returns the same object when it's called on the same String literal" # NoMethodError: undefined method `-@' for "unfrozen string"
55
60
  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.
56
61
  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.
62
+ 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
63
+ fails "String#== considers encoding compatibility" # Expected true to be false
64
+ fails "String#== considers encoding difference of incompatible string" # Expected true to be false
65
+ fails "String#=== considers encoding compatibility" # Expected true to be false
66
+ fails "String#=== considers encoding difference of incompatible string" # Expected true to be false
57
67
  fails "String#[] raises a RangeError if the index is too big" # Expected RangeError but no exception was raised (nil was returned)
58
68
  fails "String#[] with Range raises a RangeError if one of the bound is too big" # Expected RangeError but no exception was raised (nil was returned)
59
69
  fails "String#[] with Range raises a type error if a range is passed with a length" # Expected TypeError but no exception was raised ("el" was returned)
60
70
  fails "String#[] with Range returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
71
+ fails "String#[] with Range works with beginless ranges" # TypeError: no implicit conversion of NilClass into Integer
61
72
  fails "String#[] with Range works with endless ranges" # Opal::SyntaxError: undefined method `type' for nil
62
73
  fails "String#[] with Regexp returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
63
74
  fails "String#[] with Regexp, index returns String instances" # Expected "he" (StringSpecs::MyString) to be an instance of String
@@ -65,55 +76,12 @@ opal_filter "String" do
65
76
  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)
66
77
  fails "String#[] with index, length returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
67
78
  fails "String#[] with index, length returns a string with the same encoding" # ArgumentError: unknown encoding name - ISO-8859-1
68
- fails "String#[]= with Integer index allows assignment to the zero'th element of an empty String" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
69
- fails "String#[]= with Integer index calls #to_int to convert the index" # Mock 'string element set' expected to receive to_int("any_args") exactly 1 times but received it 0 times
70
- fails "String#[]= with Integer index calls #to_str to convert other to a String" # Mock '-test-' expected to receive to_str("any_args") exactly 1 times but received it 0 times
71
- fails "String#[]= with Integer index calls to_int on index" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
72
- fails "String#[]= with Integer index encodes the String in an encoding compatible with the replacement" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
73
- fails "String#[]= with Integer index raises IndexError if the string index doesn't match a position in the string" # Expected IndexError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
74
- fails "String#[]= with Integer index raises a FrozenError when self is frozen" # Expected FrozenError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
75
- fails "String#[]= with Integer index raises a TypeError if #to_int does not return an Integer" # Expected TypeError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
76
- fails "String#[]= with Integer index raises a TypeError if other_str can't be converted to a String" # Expected TypeError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
77
- fails "String#[]= with Integer index raises a TypeError if passed an Integer replacement" # Expected TypeError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
78
- fails "String#[]= with Integer index raises an Encoding::CompatibilityError if the replacement encoding is incompatible" # NameError: uninitialized constant Encoding::EUC_JP
79
- fails "String#[]= with Integer index raises an IndexError if #to_int returns a value out of range" # Expected IndexError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
80
- fails "String#[]= with Integer index raises an IndexError if the index is greater than character size" # Expected IndexError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
81
- fails "String#[]= with Integer index raises an IndexError without changing self if idx is outside of self" # Expected IndexError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
82
- fails "String#[]= with Integer index replaces a character with a multibyte character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
83
- fails "String#[]= with Integer index replaces a multibyte character with a character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
84
- fails "String#[]= with Integer index replaces a multibyte character with a multibyte character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
85
- fails "String#[]= with Integer index replaces the char at idx with other_str" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
86
- fails "String#[]= with Integer index taints self if other_str is tainted" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
87
- fails "String#[]= with Integer index, count appends other_str to the end of the string if idx == the length of the string" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
88
- fails "String#[]= with Integer index, count calls #to_int to convert the index and count objects" # Mock 'string element set index' expected to receive to_int("any_args") exactly 1 times but received it 0 times
89
- fails "String#[]= with Integer index, count calls #to_str to convert the replacement object" # Mock 'string element set replacement' expected to receive to_str("any_args") exactly 1 times but received it 0 times
90
- fails "String#[]= with Integer index, count counts negative idx values from end of the string" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
91
- fails "String#[]= with Integer index, count deletes a multibyte character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
92
- fails "String#[]= with Integer index, count deletes characters if other_str is an empty string" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
93
- fails "String#[]= with Integer index, count deletes characters up to the maximum length of the existing string" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
94
- fails "String#[]= with Integer index, count encodes the String in an encoding compatible with the replacement" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
95
- fails "String#[]= with Integer index, count inserts a multibyte character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
96
- fails "String#[]= with Integer index, count overwrites and deletes characters if count is more than the length of other_str" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
97
- fails "String#[]= with Integer index, count raises a TypeError if #to_int for count does not return an Integer" # Expected TypeError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
98
- fails "String#[]= with Integer index, count raises a TypeError if #to_int for index does not return an Integer" # Expected TypeError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
99
- fails "String#[]= with Integer index, count raises a TypeError if other_str is a type other than String" # Expected TypeError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
100
- fails "String#[]= with Integer index, count raises a TypeError of #to_str does not return a String" # Expected TypeError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
101
- fails "String#[]= with Integer index, count raises an Encoding::CompatibilityError if the replacement encoding is incompatible" # NameError: uninitialized constant Encoding::EUC_JP
102
- fails "String#[]= with Integer index, count raises an IndexError if count < 0" # Expected IndexError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
103
- fails "String#[]= with Integer index, count raises an IndexError if the character index is out of range of a multibyte String" # Expected IndexError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
104
- fails "String#[]= with Integer index, count raises an IndexError if |idx| is greater than the length of the string" # Expected IndexError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
105
- fails "String#[]= with Integer index, count replaces characters with a multibyte character" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
106
- fails "String#[]= with Integer index, count replaces multibyte characters with characters" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
107
- fails "String#[]= with Integer index, count replaces multibyte characters with multibyte characters" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
108
- fails "String#[]= with Integer index, count starts at idx and overwrites count characters before inserting the rest of other_str" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
109
- fails "String#[]= with Integer index, count taints self if other_str is tainted" # NotImplementedError: String#[]= not supported. Mutable String methods are not supported in Opal.
110
- fails "String#[]= with a Regexp index with 3 arguments raises a TypeError if #to_int does not return an Integer" # Expected TypeError but got: NotImplementedError (String#[]= not supported. Mutable String methods are not supported in Opal.)
111
- fails "String#ascii_only? with non-ASCII only characters returns false if the encoding is BINARY" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
112
79
  fails "String#bytes yields each byte to a block if one is given, returning self" # Expected [113, 103, 172, 78] to equal "東京"
113
80
  fails "String#byteslice raises a RangeError if the index is too big" # Expected RangeError but no exception was raised (nil was returned)
114
81
  fails "String#byteslice with Range raises a RangeError if one of the bound is too big" # Expected RangeError but no exception was raised (nil was returned)
115
82
  fails "String#byteslice with Range raises a type error if a range is passed with a length" # Expected TypeError but no exception was raised ("el" was returned)
116
83
  fails "String#byteslice with Range returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
84
+ fails "String#byteslice with Range works with beginless ranges" # TypeError: no implicit conversion of NilClass into Integer
117
85
  fails "String#byteslice with Range works with endless ranges" # Opal::SyntaxError: undefined method `type' for nil
118
86
  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)
119
87
  fails "String#byteslice with index, length returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
@@ -126,9 +94,6 @@ opal_filter "String" do
126
94
  fails "String#capitalize full Unicode case mapping only capitalizes the first resulting character when upcasing a character produces a multi-character sequence" # Expected "SS" to equal "Ss"
127
95
  fails "String#capitalize full Unicode case mapping updates string metadata" # Expected "SSet" to equal "Sset"
128
96
  fails "String#capitalize returns String instances when called on a subclass" # Expected "Hello" (StringSpecs::MyString) to be an instance of String
129
- fails "String#capitalize! full Unicode case mapping works for non-ascii-compatible encodings" # NotImplementedError: String#capitalize! not supported. Mutable String methods are not supported in Opal.
130
- fails "String#capitalize! modifies self in place for ASCII-only case mapping works for non-ascii-compatible encodings" # NotImplementedError: String#capitalize! not supported. Mutable String methods are not supported in Opal.
131
- fails "String#capitalize! modifies self in place for non-ascii-compatible encodings" # NotImplementedError: String#capitalize! not supported. Mutable String methods are not supported in Opal.
132
97
  fails "String#casecmp independent of case returns nil if incompatible encodings" # NameError: uninitialized constant Encoding::EUC_JP
133
98
  fails "String#casecmp? independent of case case folds" # Expected false to be true
134
99
  fails "String#casecmp? independent of case for UNICODE characters returns true when downcase(:fold) on unicode" # Expected false to equal true
@@ -136,10 +101,10 @@ opal_filter "String" do
136
101
  fails "String#casecmp? independent of case returns nil if incompatible encodings" # NameError: uninitialized constant Encoding::EUC_JP
137
102
  fails "String#center with length, padding returns String instances when called on subclasses" # Expected " " (StringSpecs::MyString) to be an instance of String
138
103
  fails "String#chomp when passed no argument returns String instances when called on a subclass" # Expected "hello" (StringSpecs::MyString) to be an instance of String
104
+ 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"
139
105
  fails "String#chop returns String instances when called on a subclass" # Expected "hello" (StringSpecs::MyString) to be an instance of String
140
106
  fails "String#clone calls #initialize_copy on the new instance" # Expected nil to equal "string"
141
107
  fails "String#clone copies singleton methods" # NoMethodError: undefined method `special' for "string"
142
- fails "String#codepoints is synonymous with #bytes for Strings which are single-byte optimizable" # Expected [40, 41, 123, 125] to equal [40, 0, 41, 0, 123, 0, 125, 0]
143
108
  fails "String#concat when self is BINARY and argument is US-ASCII uses BINARY encoding" # NoMethodError: undefined method `concat' for "abc"
144
109
  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 ""
145
110
  fails "String#delete returns String instances when called on a subclass" # Expected "oh no" (StringSpecs::MyString) to be an instance of String
@@ -152,8 +117,6 @@ opal_filter "String" do
152
117
  fails "String#downcase full Unicode case mapping adapted for Turkic languages allows Lithuanian as an extra option" # ArgumentError: [String#downcase] wrong number of arguments(2 for 0)
153
118
  fails "String#downcase full Unicode case mapping adapted for Turkic languages downcases characters according to Turkic semantics" # ArgumentError: [String#downcase] wrong number of arguments(1 for 0)
154
119
  fails "String#downcase returns a String instance for subclasses" # Expected "foobar" (StringSpecs::MyString) to be an instance of String
155
- fails "String#downcase! ASCII-only case mapping works for non-ascii-compatible encodings" # NotImplementedError: String#downcase! not supported. Mutable String methods are not supported in Opal.
156
- fails "String#downcase! modifies self in place for non-ascii-compatible encodings" # NotImplementedError: String#downcase! not supported. Mutable String methods are not supported in Opal.
157
120
  fails "String#dump does not take into account if a string is frozen" # NoMethodError: undefined method `dump' for "foo"
158
121
  fails "String#dump includes .force_encoding(name) if the encoding isn't ASCII compatible" # NoMethodError: undefined method `dump' for "ࡶ"
159
122
  fails "String#dump keeps origin encoding" # ArgumentError: unknown encoding name - ISO-8859-1
@@ -175,8 +138,6 @@ opal_filter "String" do
175
138
  fails "String#dump wraps string with \"" # NoMethodError: undefined method `dump' for "foo"
176
139
  fails "String#dup calls #initialize_copy on the new instance" # Expected nil to equal "string"
177
140
  fails "String#each_byte keeps iterating from the old position (to new string end) when self changes" # NotImplementedError: String#<< not supported. Mutable String methods are not supported in Opal.
178
- fails "String#each_byte when no block is given returned enumerator size should return the bytesize of the string" # Expected nil to equal 10
179
- fails "String#each_codepoint is synonymous with #bytes for Strings which are single-byte optimizable" # Expected [40, 41, 123, 125] to equal [40, 0, 41, 0, 123, 0, 125, 0]
180
141
  fails "String#each_grapheme_cluster is unicode aware" # NoMethodError: undefined method `each_grapheme_cluster' for "Ç∂éƒg"
181
142
  fails "String#each_grapheme_cluster passes each char in self to the given block" # NoMethodError: undefined method `each_grapheme_cluster' for "hello"
182
143
  fails "String#each_grapheme_cluster passes each grapheme cluster in self to the given block" # NoMethodError: undefined method `each_grapheme_cluster' for "ab🏳️\u200D🌈🐾"
@@ -199,11 +160,11 @@ opal_filter "String" do
199
160
  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
200
161
  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> to equal #<Encoding:ASCII-8BIT (dummy)>
201
162
  fails "String#end_with? raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
163
+ fails "String#eql? considers encoding compatibility" # Expected true to be false
164
+ fails "String#eql? considers encoding difference of incompatible string" # Expected true to be false
202
165
  fails "String#force_encoding with a special encoding name accepts valid special encoding names" # NoMethodError: undefined method `default_internal' for Encoding
203
166
  fails "String#force_encoding with a special encoding name defaults to ASCII-8BIT if special encoding name is not set" # NoMethodError: undefined method `default_internal' for Encoding
204
167
  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
205
- fails "String#getbyte interprets bytes relative to the String's encoding" # NotImplementedError: NotImplementedError
206
- fails "String#getbyte returns an Integer between 0 and 255" # NotImplementedError: NotImplementedError
207
168
  fails "String#grapheme_clusters is unicode aware" # NoMethodError: undefined method `grapheme_clusters' for "Ç∂éƒg"
208
169
  fails "String#grapheme_clusters passes each char in self to the given block" # NoMethodError: undefined method `grapheme_clusters' for "hello"
209
170
  fails "String#grapheme_clusters passes each grapheme cluster in self to the given block" # NoMethodError: undefined method `grapheme_clusters' for "ab🏳️\u200D🌈🐾"
@@ -216,9 +177,17 @@ opal_filter "String" do
216
177
  fails "String#grapheme_clusters works if the String's contents is invalid for its encoding" # Expected true to be false
217
178
  fails "String#grapheme_clusters works with multibyte characters" # NoMethodError: undefined method `grapheme_clusters' for "覇"
218
179
  fails "String#gsub with pattern and block does not set $~ for procs created from methods" # Expected "he<l><l>o" == "he<unset><unset>o" to be truthy but was false
180
+ fails "String#gsub with pattern and block raises an Encoding::CompatibilityError if the encodings are not compatible" # Expected Encoding::CompatibilityError but got: ArgumentError (unknown encoding name - iso-8859-5)
181
+ fails "String#gsub with pattern and block replaces the incompatible part properly even if the encodings are not compatible" # ArgumentError: unknown encoding name - iso-8859-5
182
+ fails "String#gsub with pattern and block uses the compatible encoding if they are compatible" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT> to be truthy but was false
183
+ fails "String#gsub with pattern and replacement doesn't freak out when replacing ^" # Expected " Text " == " Text " to be truthy but was false
184
+ fails "String#gsub with pattern and replacement replaces \\k named backreferences with the regexp's corresponding capture" # Exception: named captures are not supported in javascript: "(?<foo>[aeiou])"
219
185
  fails "String#gsub with pattern and replacement returns String instances when called on a subclass" # Expected "" (StringSpecs::MyString) to be an instance of String
186
+ 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
220
187
  fails "String#include? with String raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
188
+ fails "String#inspect returns a string with non-printing characters replaced by \\x notation" # Expected "\"\\xA0\"" to be computed by " ".inspect (computed "\" \"" instead)
221
189
  fails "String#inspect uses \\x notation for broken UTF-8 sequences" # Expected "\"ð\\u009F\"" == "\"\\xF0\\x9F\"" to be truthy but was false
190
+ fails "String#inspect when the string's encoding is different than the result's encoding and the string has both ASCII-compatible and ASCII-incompatible chars returns a string with the non-ASCII characters replaced by \\u notation" # Expected "\"hello привет\"" == "\"hello \\u043F\\u0440\\u0438\\u0432\\u0435\\u0442\"" to be truthy but was false
222
191
  fails "String#inspect when the string's encoding is different than the result's encoding and the string's encoding is ASCII-compatible but the characters are non-ASCII returns a string with the non-ASCII characters replaced by \\x notation" # ArgumentError: unknown encoding name - EUC-JP
223
192
  fails "String#intern raises an EncodingError for UTF-8 String containing invalid bytes" # Expected true to equal false
224
193
  fails "String#intern returns a US-ASCII Symbol for a UTF-8 String containing only US-ASCII characters" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
@@ -235,12 +204,14 @@ opal_filter "String" do
235
204
  fails "String#ljust with length, padding returns String instances when called on subclasses" # Expected " " (StringSpecs::MyString) to be an instance of String
236
205
  fails "String#next returns String instances when called on a subclass" # Expected "" (StringSpecs::MyString) to be an instance of String
237
206
  fails "String#rjust with length, padding returns String instances when called on subclasses" # Expected " " (StringSpecs::MyString) to be an instance of String
207
+ fails "String#rpartition with String returns new object if doesn't match" # Expected "hello".equal? "hello" to be falsy but was true
238
208
  fails "String#scan with pattern and block passes block arguments as individual arguments when blocks are provided" # Expected ["a", "b", "c"] to equal "a"
239
209
  fails "String#size returns the correct length after force_encoding(BINARY)" # Expected 2 == 4 to be truthy but was false
240
210
  fails "String#slice raises a RangeError if the index is too big" # Expected RangeError but no exception was raised (nil was returned)
241
211
  fails "String#slice with Range raises a RangeError if one of the bound is too big" # Expected RangeError but no exception was raised (nil was returned)
242
212
  fails "String#slice with Range raises a type error if a range is passed with a length" # Expected TypeError but no exception was raised ("el" was returned)
243
213
  fails "String#slice with Range returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
214
+ fails "String#slice with Range works with beginless ranges" # TypeError: no implicit conversion of NilClass into Integer
244
215
  fails "String#slice with Range works with endless ranges" # Opal::SyntaxError: undefined method `type' for nil
245
216
  fails "String#slice with Regexp returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
246
217
  fails "String#slice with Regexp, index returns String instances" # Expected "he" (StringSpecs::MyString) to be an instance of String
@@ -248,28 +219,25 @@ opal_filter "String" do
248
219
  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)
249
220
  fails "String#slice with index, length returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
250
221
  fails "String#slice with index, length returns a string with the same encoding" # ArgumentError: unknown encoding name - ISO-8859-1
251
- fails "String#slice! Range returns String instances" # NotImplementedError: String#slice! not supported. Mutable String methods are not supported in Opal.
252
- fails "String#slice! with Regexp returns String instances" # NotImplementedError: String#slice! not supported. Mutable String methods are not supported in Opal.
253
- fails "String#slice! with Regexp, index returns String instances" # NotImplementedError: String#slice! not supported. Mutable String methods are not supported in Opal.
254
- fails "String#slice! with index, length returns String instances" # NotImplementedError: String#slice! not supported. Mutable String methods are not supported in Opal.
222
+ fails "String#split with Regexp allows concurrent Regexp calls in a shared context" # NotImplementedError: Thread creation not available
255
223
  fails "String#split with Regexp applies the limit to the number of split substrings, without counting captures" # Expected ["a", "aBa"] to equal ["a", "B", "", "", "aBa"]
256
224
  fails "String#split with Regexp for a String subclass yields instances of String" # Expected nil (NilClass) to be an instance of String
257
225
  fails "String#split with Regexp returns String instances based on self" # Expected "x" (StringSpecs::MyString) to be an instance of String
226
+ fails "String#split with Regexp returns an ArgumentError if an invalid UTF-8 string is supplied" # NotImplementedError: String#chop! not supported. Mutable String methods are not supported in Opal.
258
227
  fails "String#split with Regexp when a block is given returns a string as is (and doesn't call block) if it is empty" # Expected [] == "" to be truthy but was false
259
228
  fails "String#split with Regexp when a block is given yields each split letter" # Expected ["c", "h", "u", "n", "k", "y"] == "chunky" to be truthy but was false
260
229
  fails "String#split with Regexp when a block is given yields each split substring with a pattern" # Expected ["chunky", "bacon"] == "chunky-bacon" to be truthy but was false
261
230
  fails "String#split with Regexp when a block is given yields each split substring with a regexp pattern" # Expected ["chunky", "bacon"] == "chunky:bacon" to be truthy but was false
231
+ fails "String#split with Regexp when a block is given yields each split substring with default pattern for a non-ASCII string" # Expected ["l'été", "arrive", "bientôt"] == "l'été arrive bientôt" to be truthy but was false
262
232
  fails "String#split with Regexp when a block is given yields each split substring with default pattern" # Expected ["chunky", "bacon"] == "chunky bacon" to be truthy but was false
263
233
  fails "String#split with Regexp when a block is given yields each split substring with empty regexp pattern and limit" # Expected ["c", "h", "unky"] == "chunky" to be truthy but was false
264
234
  fails "String#split with Regexp when a block is given yields each split substring with empty regexp pattern" # Expected ["c", "h", "u", "n", "k", "y"] == "chunky" to be truthy but was false
265
235
  fails "String#split with Regexp when a block is given yields the string when limit is 1" # Expected ["chunky bacon"] == "chunky bacon" to be truthy but was false
266
236
  fails "String#split with String returns String instances based on self" # Expected "x" (StringSpecs::MyString) to be an instance of String
267
237
  fails "String#squeeze returns String instances when called on a subclass" # Expected "oh no!" (StringSpecs::MyString) to be an instance of String
268
- fails "String#start_with? sets Regexp.last_match if it returns true" # TypeError: no implicit conversion of Regexp into String
269
- fails "String#start_with? supports regexps with ^ and $ modifiers" # TypeError: no implicit conversion of Regexp into String
270
- fails "String#start_with? supports regexps" # TypeError: no implicit conversion of Regexp into String
271
238
  fails "String#sub with pattern, replacement returns String instances when called on a subclass" # Expected "" (StringSpecs::MyString) to be an instance of String
272
239
  fails "String#sub with pattern, replacement returns a copy of self when no modification is made" # Expected "hello" not to be identical to "hello"
240
+ 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
273
241
  fails "String#succ returns String instances when called on a subclass" # Expected "" (StringSpecs::MyString) to be an instance of String
274
242
  fails "String#swapcase ASCII-only case mapping does not swapcase non-ASCII characters" # ArgumentError: [String#swapcase] wrong number of arguments(1 for 0)
275
243
  fails "String#swapcase full Unicode case mapping adapted for Lithuanian allows Turkic as an extra option (and applies Turkic semantics)" # ArgumentError: [String#swapcase] wrong number of arguments(2 for 0)
@@ -280,9 +248,6 @@ opal_filter "String" do
280
248
  fails "String#swapcase full Unicode case mapping works for all of Unicode with no option" # Expected "äÖü" to equal "ÄöÜ"
281
249
  fails "String#swapcase returns String instances when called on a subclass" # Expected "" (StringSpecs::MyString) to be an instance of String
282
250
  fails "String#swapcase works for all of Unicode" # Expected "äÖü" to equal "ÄöÜ"
283
- fails "String#swapcase! full Unicode case mapping works for non-ascii-compatible encodings" # NotImplementedError: String#swapcase! not supported. Mutable String methods are not supported in Opal.
284
- fails "String#swapcase! modifies self in place for ASCII-only case mapping works for non-ascii-compatible encodings" # NotImplementedError: String#swapcase! not supported. Mutable String methods are not supported in Opal.
285
- fails "String#swapcase! modifies self in place for non-ascii-compatible encodings" # NotImplementedError: String#swapcase! not supported. Mutable String methods are not supported in Opal.
286
251
  fails "String#to_sym raises an EncodingError for UTF-8 String containing invalid bytes" # Expected true to equal false
287
252
  fails "String#to_sym returns a US-ASCII Symbol for a UTF-8 String containing only US-ASCII characters" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
288
253
  fails "String#to_sym returns a US-ASCII Symbol for a binary String containing only US-ASCII characters" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
@@ -331,11 +296,7 @@ opal_filter "String" do
331
296
  fails "String#upcase full Unicode case mapping adapted for Turkic languages allows Lithuanian as an extra option" # ArgumentError: [String#upcase] wrong number of arguments(2 for 0)
332
297
  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(1 for 0)
333
298
  fails "String#upcase returns a String instance for subclasses" # Expected "FOOBAR" (StringSpecs::MyString) to be an instance of String
334
- fails "String#upcase! full Unicode case mapping works for non-ascii-compatible encodings" # NotImplementedError: String#upcase! not supported. Mutable String methods are not supported in Opal.
335
- fails "String#upcase! modifies self in place for ASCII-only case mapping works for non-ascii-compatible encodings" # NotImplementedError: String#upcase! not supported. Mutable String methods are not supported in Opal.
336
- fails "String#upcase! modifies self in place for non-ascii-compatible encodings" # NotImplementedError: String#upcase! not supported. Mutable String methods are not supported in Opal.
337
299
  fails "String#valid_encoding? returns true for IBM720 encoding self is valid in" # ArgumentError: unknown encoding name - IBM720
338
- fails "String.new accepts a capacity argument" # ArgumentError: [String.new] wrong number of arguments(2 for -1)
339
300
  fails "String.new accepts an encoding argument" # ArgumentError: [String.new] wrong number of arguments(2 for -1)
340
301
  fails "String.new is called on subclasses" # Expected nil to equal "subclass"
341
302
  end