opal 1.4.0.alpha1 → 1.5.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +5 -3
  3. data/.github/workflows/build.yml +20 -18
  4. data/.rubocop.yml +1 -0
  5. data/CHANGELOG.md +98 -7
  6. data/UNRELEASED.md +31 -59
  7. data/benchmark-ips/bm_js_symbols_vs_strings.rb +39 -14
  8. data/docs/releasing.md +11 -4
  9. data/lib/opal/ast/matcher.rb +77 -0
  10. data/lib/opal/cache.rb +1 -1
  11. data/lib/opal/cli_runners/applescript.rb +2 -0
  12. data/lib/opal/compiler.rb +18 -9
  13. data/lib/opal/nodes/call.rb +73 -28
  14. data/lib/opal/nodes/def.rb +31 -27
  15. data/lib/opal/nodes/definitions.rb +2 -0
  16. data/lib/opal/nodes/helpers.rb +4 -23
  17. data/lib/opal/nodes/if.rb +226 -0
  18. data/lib/opal/nodes/iter.rb +41 -37
  19. data/lib/opal/nodes/literal.rb +2 -2
  20. data/lib/opal/nodes/masgn.rb +15 -17
  21. data/lib/opal/nodes/node_with_args/shortcuts.rb +100 -0
  22. data/lib/opal/nodes/node_with_args.rb +1 -0
  23. data/lib/opal/nodes/super.rb +9 -9
  24. data/lib/opal/nodes/top.rb +26 -10
  25. data/lib/opal/nodes/x_string.rb +27 -28
  26. data/lib/opal/nodes.rb +0 -1
  27. data/lib/opal/parser/default_config.rb +3 -2
  28. data/lib/opal/repl.rb +1 -1
  29. data/lib/opal/rewriter.rb +13 -6
  30. data/lib/opal/rewriters/base.rb +12 -1
  31. data/lib/opal/rewriters/rubyspec/filters_rewriter.rb +1 -0
  32. data/lib/opal/version.rb +1 -1
  33. data/opal/corelib/array.rb +23 -28
  34. data/opal/corelib/binding.rb +14 -4
  35. data/opal/corelib/constants.rb +3 -3
  36. data/opal/corelib/hash.rb +2 -2
  37. data/opal/corelib/irb.rb +192 -0
  38. data/opal/corelib/math/polyfills.rb +127 -0
  39. data/opal/corelib/math.rb +14 -194
  40. data/opal/corelib/module.rb +25 -40
  41. data/opal/corelib/number.rb +63 -14
  42. data/opal/corelib/regexp.rb +2 -0
  43. data/opal/corelib/runtime.js +56 -20
  44. data/opal/corelib/string.rb +38 -59
  45. data/opal/corelib/time.rb +106 -68
  46. data/opal/opal/full.rb +0 -1
  47. data/opal/opal.rb +4 -1
  48. data/spec/filters/bugs/date.rb +0 -3
  49. data/spec/filters/bugs/datetime.rb +65 -0
  50. data/spec/filters/bugs/float.rb +0 -18
  51. data/spec/filters/bugs/hash.rb +0 -2
  52. data/spec/filters/bugs/language.rb +0 -3
  53. data/spec/filters/bugs/marshal.rb +0 -1
  54. data/spec/filters/bugs/string.rb +0 -30
  55. data/spec/filters/bugs/time.rb +18 -8
  56. data/spec/lib/cli_spec.rb +2 -2
  57. data/spec/lib/compiler_spec.rb +8 -8
  58. data/spec/lib/rewriters/base_spec.rb +1 -1
  59. data/spec/lib/rewriters/binary_operator_assignment_spec.rb +34 -59
  60. data/spec/lib/rewriters/block_to_iter_spec.rb +3 -6
  61. data/spec/lib/rewriters/dot_js_syntax_spec.rb +2 -5
  62. data/spec/lib/rewriters/for_rewriter_spec.rb +0 -1
  63. data/spec/lib/rewriters/forward_args_spec.rb +2 -3
  64. data/spec/lib/rewriters/js_reserved_words_spec.rb +2 -15
  65. data/spec/lib/rewriters/logical_operator_assignment_spec.rb +64 -89
  66. data/spec/lib/rewriters/numblocks_spec.rb +3 -5
  67. data/spec/lib/rewriters/opal_engine_check_spec.rb +2 -14
  68. data/spec/lib/rewriters/rubyspec/filters_rewriter_spec.rb +10 -2
  69. data/spec/opal/compiler/irb_spec.rb +4 -0
  70. data/spec/opal/core/language/super_spec.rb +40 -17
  71. data/spec/opal/core/language/xstring_spec.rb +13 -0
  72. data/spec/opal/core/regexp/assertions_spec.rb +19 -0
  73. data/spec/opal/core/string/to_proc_spec.rb +19 -0
  74. data/spec/ruby_specs +4 -0
  75. data/spec/support/rewriters_helper.rb +43 -23
  76. data/stdlib/date/date_time.rb +71 -0
  77. data/stdlib/date/formatters.rb +28 -0
  78. data/stdlib/date/infinity.rb +73 -0
  79. data/stdlib/date.rb +77 -214
  80. data/stdlib/opal/repl_js.rb +1 -1
  81. data/stdlib/{opal/replutils.rb → opal-replutils.rb} +3 -3
  82. data/stdlib/promise/v2.rb +0 -7
  83. data/stdlib/time.rb +39 -2
  84. data/stdlib/uri.rb +53 -0
  85. data/tasks/performance/asciidoctor_test.rb.erb +3 -1
  86. data/tasks/performance/optimization_status.rb +3 -2
  87. data/tasks/performance.rake +69 -35
  88. data/tasks/testing.rake +1 -0
  89. data/test/opal/test_uri.rb +35 -0
  90. data/yarn.lock +27 -5
  91. metadata +30 -16
  92. data/lib/opal/nodes/csend.rb +0 -24
  93. data/lib/opal/rewriters/explicit_writer_return.rb +0 -59
  94. data/spec/lib/rewriters/explicit_writer_return_spec.rb +0 -186
  95. data/stdlib/nodejs/irb.rb +0 -43
data/opal/corelib/time.rb CHANGED
@@ -21,7 +21,7 @@ class ::Time < `Date`
21
21
  #{::Kernel.raise ::TypeError, "can't convert Time into an exact number"}
22
22
  }
23
23
  result = new Date(seconds.getTime());
24
- result.is_utc = seconds.is_utc;
24
+ result.timezone = seconds.timezone;
25
25
  return result;
26
26
  }
27
27
 
@@ -135,16 +135,12 @@ class ::Time < `Date`
135
135
 
136
136
  def self.new(year = undefined, month = nil, day = nil, hour = nil, min = nil, sec = nil, utc_offset = nil)
137
137
  %x{
138
- var args, result;
138
+ var args, result, timezone;
139
139
 
140
140
  if (year === undefined) {
141
141
  return new Date();
142
142
  }
143
143
 
144
- if (utc_offset !== nil) {
145
- #{::Kernel.raise ::ArgumentError, 'Opal does not support explicitly specifying UTC offset for Time'}
146
- }
147
-
148
144
  args = time_params(year, month, day, hour, min, sec);
149
145
  year = args[0];
150
146
  month = args[1];
@@ -157,10 +153,51 @@ class ::Time < `Date`
157
153
  if (year < 100) {
158
154
  result.setFullYear(year);
159
155
  }
156
+
157
+ if (utc_offset !== nil) {
158
+ timezone = #{_parse_offset(utc_offset)};
159
+ }
160
+
161
+ if (timezone != null) {
162
+ result = new Date(result.getTime() - timezone * 3600000 - result.getTimezoneOffset() * 60000);
163
+ result.timezone = timezone;
164
+ }
165
+
160
166
  return result;
161
167
  }
162
168
  end
163
169
 
170
+ # @private
171
+ def self._parse_offset(utc_offset)
172
+ %x{
173
+ var timezone;
174
+ if (utc_offset.$$is_string) {
175
+ if (utc_offset == 'UTC') {
176
+ timezone = 0;
177
+ }
178
+ else if(/^[+-]\d\d:[0-5]\d$/.test(utc_offset)) {
179
+ var sign, hours, minutes;
180
+ sign = utc_offset[0];
181
+ hours = +(utc_offset[1] + utc_offset[2]);
182
+ minutes = +(utc_offset[4] + utc_offset[5]);
183
+
184
+ timezone = (sign == '-' ? -1 : 1) * (hours + minutes / 60);
185
+ }
186
+ else {
187
+ // Unsupported: "A".."I","K".."Z"
188
+ #{::Kernel.raise ::ArgumentError, %'"+HH:MM", "-HH:MM", "UTC" expected for utc_offset: #{utc_offset}'}
189
+ }
190
+ }
191
+ else if (utc_offset.$$is_number) {
192
+ timezone = utc_offset / 3600;
193
+ }
194
+ else {
195
+ #{::Kernel.raise ::ArgumentError, "Opal doesn't support other types for a timezone argument than Integer and String"}
196
+ }
197
+ return timezone;
198
+ }
199
+ end
200
+
164
201
  def self.local(year, month = nil, day = nil, hour = nil, min = nil, sec = nil, millisecond = nil, _dummy1 = nil, _dummy2 = nil, _dummy3 = nil)
165
202
  # The _dummy args are there only because the MRI version accepts up to 10 arguments
166
203
  %x{
@@ -219,7 +256,7 @@ class ::Time < `Date`
219
256
  if (year < 100) {
220
257
  result.setUTCFullYear(year);
221
258
  }
222
- result.is_utc = true;
259
+ result.timezone = 0;
223
260
  return result;
224
261
  }
225
262
  end
@@ -238,7 +275,7 @@ class ::Time < `Date`
238
275
  other = #{::Opal.coerce_to!(other, ::Integer, :to_int)};
239
276
  }
240
277
  var result = new Date(self.getTime() + (other * 1000));
241
- result.is_utc = self.is_utc;
278
+ result.timezone = self.timezone;
242
279
  return result;
243
280
  }
244
281
  end
@@ -253,7 +290,7 @@ class ::Time < `Date`
253
290
  other = #{::Opal.coerce_to!(other, ::Integer, :to_int)};
254
291
  }
255
292
  var result = new Date(self.getTime() - (other * 1000));
256
- result.is_utc = self.is_utc;
293
+ result.timezone = self.timezone;
257
294
  return result;
258
295
  }
259
296
  end
@@ -283,8 +320,22 @@ class ::Time < `Date`
283
320
  strftime '%a %b %e %H:%M:%S %Y'
284
321
  end
285
322
 
286
- def day
287
- `self.is_utc ? self.getUTCDate() : self.getDate()`
323
+ [
324
+ [:year, 'getFullYear', 'getUTCFullYear'],
325
+ [:mon, 'getMonth', 'getUTCMonth', 1],
326
+ [:wday, 'getDay', 'getUTCDay'],
327
+ [:day, 'getDate', 'getUTCDate'],
328
+ [:hour, 'getHours', 'getUTCHours'],
329
+ [:min, 'getMinutes', 'getUTCMinutes'],
330
+ [:sec, 'getSeconds', 'getUTCSeconds'],
331
+ ].each do |method, getter, utcgetter, difference = 0|
332
+ define_method method do
333
+ %x{
334
+ return difference + ((self.timezone != null) ?
335
+ (new Date(self.getTime() + self.timezone * 3600000))[utcgetter]() :
336
+ self[getter]())
337
+ }
338
+ end
288
339
  end
289
340
 
290
341
  def yday
@@ -319,18 +370,24 @@ class ::Time < `Date`
319
370
  other.is_a?(::Time) && (self <=> other).zero?
320
371
  end
321
372
 
322
- def friday?
323
- `#{wday} == 5`
373
+ [
374
+ [:sunday?, 0],
375
+ [:monday?, 1],
376
+ [:tuesday?, 2],
377
+ [:wednesday?, 3],
378
+ [:thursday?, 4],
379
+ [:friday?, 5],
380
+ [:saturday?, 6]
381
+ ].each do |method, weekday|
382
+ define_method method do
383
+ `#{wday} === weekday`
384
+ end
324
385
  end
325
386
 
326
387
  def hash
327
388
  `'Time:' + self.getTime()`
328
389
  end
329
390
 
330
- def hour
331
- `self.is_utc ? self.getUTCHours() : self.getHours()`
332
- end
333
-
334
391
  def inspect
335
392
  if utc?
336
393
  strftime '%Y-%m-%d %H:%M:%S UTC'
@@ -339,30 +396,10 @@ class ::Time < `Date`
339
396
  end
340
397
  end
341
398
 
342
- def min
343
- `self.is_utc ? self.getUTCMinutes() : self.getMinutes()`
344
- end
345
-
346
- def mon
347
- `(self.is_utc ? self.getUTCMonth() : self.getMonth()) + 1`
348
- end
349
-
350
- def monday?
351
- `#{wday} == 1`
352
- end
353
-
354
- def saturday?
355
- `#{wday} == 6`
356
- end
357
-
358
- def sec
359
- `self.is_utc ? self.getUTCSeconds() : self.getSeconds()`
360
- end
361
-
362
399
  def succ
363
400
  %x{
364
401
  var result = new Date(self.getTime() + 1000);
365
- result.is_utc = self.is_utc;
402
+ result.timezone = self.timezone;
366
403
  return result;
367
404
  }
368
405
  end
@@ -373,6 +410,9 @@ class ::Time < `Date`
373
410
 
374
411
  def zone
375
412
  %x{
413
+ if (self.timezone === 0) return "UTC";
414
+ else if (self.timezone != null) return nil;
415
+
376
416
  var string = self.toString(),
377
417
  result;
378
418
 
@@ -395,30 +435,30 @@ class ::Time < `Date`
395
435
  def getgm
396
436
  %x{
397
437
  var result = new Date(self.getTime());
398
- result.is_utc = true;
438
+ result.timezone = 0;
399
439
  return result;
400
440
  }
401
441
  end
402
442
 
403
443
  def gmtime
404
444
  %x{
405
- self.is_utc = true;
445
+ self.timezone = 0;
406
446
  return self;
407
447
  }
408
448
  end
409
449
 
410
450
  def gmt?
411
- `self.is_utc === true`
451
+ `self.timezone === 0`
412
452
  end
413
453
 
414
454
  def gmt_offset
415
- `self.is_utc ? 0 : -self.getTimezoneOffset() * 60`
455
+ `(self.timezone != null) ? self.timezone * 60 : -self.getTimezoneOffset() * 60`
416
456
  end
417
457
 
418
458
  def strftime(format)
419
459
  %x{
420
460
  return format.replace(/%([\-_#^0]*:{0,2})(\d+)?([EO]*)(.)/g, function(full, flags, width, _, conv) {
421
- var result = "",
461
+ var result = "", jd, c, s,
422
462
  zero = flags.indexOf('0') !== -1,
423
463
  pad = flags.indexOf('-') === -1,
424
464
  blank = flags.indexOf('_') !== -1,
@@ -534,7 +574,7 @@ class ::Time < `Date`
534
574
  break;
535
575
 
536
576
  case 'z':
537
- var offset = self.getTimezoneOffset(),
577
+ var offset = (self.timezone == null) ? self.getTimezoneOffset() : (-self.timezone * 60),
538
578
  hours = Math.floor(Math.abs(offset) / 60),
539
579
  minutes = Math.abs(offset) % 60;
540
580
 
@@ -633,6 +673,28 @@ class ::Time < `Date`
633
673
  result += #{strftime('%H:%M:%S')};
634
674
  break;
635
675
 
676
+ // Non-standard: JIS X 0301 date format
677
+ case 'J':
678
+ jd = #{to_date.jd};
679
+ if (jd < 2405160) {
680
+ result += #{strftime('%Y-%m-%d')};
681
+ break;
682
+ }
683
+ else if (jd < 2419614)
684
+ c = 'M', s = 1867;
685
+ else if (jd < 2424875)
686
+ c = 'T', s = 1911;
687
+ else if (jd < 2447535)
688
+ c = 'S', s = 1925;
689
+ else if (jd < 2458605)
690
+ c = 'H', s = 1988;
691
+ else
692
+ c = 'R', s = 2018;
693
+
694
+ result += #{format '%c%02d', `c`, year - `s`};
695
+ result += #{strftime('-%m-%d')};
696
+ break;
697
+
636
698
  default:
637
699
  return full;
638
700
  }
@@ -655,14 +717,6 @@ class ::Time < `Date`
655
717
  }
656
718
  end
657
719
 
658
- def sunday?
659
- `#{wday} == 0`
660
- end
661
-
662
- def thursday?
663
- `#{wday} == 4`
664
- end
665
-
666
720
  def to_a
667
721
  [sec, min, hour, day, month, year, wday, yday, isdst, zone]
668
722
  end
@@ -675,22 +729,6 @@ class ::Time < `Date`
675
729
  `parseInt(self.getTime() / 1000, 10)`
676
730
  end
677
731
 
678
- def tuesday?
679
- `#{wday} == 2`
680
- end
681
-
682
- def wday
683
- `self.is_utc ? self.getUTCDay() : self.getDay()`
684
- end
685
-
686
- def wednesday?
687
- `#{wday} == 3`
688
- end
689
-
690
- def year
691
- `self.is_utc ? self.getUTCFullYear() : self.getFullYear()`
692
- end
693
-
694
732
  def cweek_cyear
695
733
  jan01 = ::Time.new(year, 1, 1)
696
734
  jan01_wday = jan01.wday
data/opal/opal/full.rb CHANGED
@@ -5,4 +5,3 @@
5
5
  ::Object.require 'corelib/pattern_matching/base'
6
6
  ::Object.autoload :PatternMatching, 'corelib/pattern_matching'
7
7
  ::Object.autoload :TracePoint, 'corelib/trace_point'
8
- ::Object.require 'corelib/binding'
data/opal/opal.rb CHANGED
@@ -10,7 +10,7 @@
10
10
  ::Object.autoload :Rational, 'corelib/rational'
11
11
  ::Object.require 'corelib/time'
12
12
  ::Object.autoload :Struct, 'corelib/struct'
13
- ::Object.require 'corelib/dir'
13
+ ::Object.autoload :Dir, 'corelib/dir'
14
14
  ::Object.autoload :File, 'corelib/file'
15
15
 
16
16
  ::Object.require 'corelib/process/base'
@@ -18,3 +18,6 @@
18
18
  ::Object.autoload :Random, 'corelib/random'
19
19
 
20
20
  ::Object.require 'corelib/unsupported'
21
+
22
+ ::Object.require 'corelib/binding'
23
+ ::Object.require 'corelib/irb'
@@ -20,9 +20,7 @@ opal_filter "Date" do
20
20
  fails "Date#julian converts a date object into another with the Julian calendar"
21
21
  fails "Date#julian? marks a day before the calendar reform as Julian"
22
22
  fails "Date#ld determines the Modified Julian day"
23
- fails "Date#mday determines the day of the month"
24
23
  fails "Date#mjd determines the Modified Julian day"
25
- fails "Date#mon determines the month"
26
24
  fails "Date#new_start converts a date object into another with a new calendar reform"
27
25
  fails "Date#parse coerces using to_str" # ArgumentError: invalid date
28
26
  fails "Date#parse parses a day name into a Date object"
@@ -72,7 +70,6 @@ opal_filter "Date" do
72
70
  fails "Date#valid_date? handles negative months and days"
73
71
  fails "Date#valid_date? returns false if it is not a valid civil date"
74
72
  fails "Date#valid_date? returns true if it is a valid civil date"
75
- fails "Date#yday determines the year"
76
73
  fails "Date._iso8601 returns an empty hash if the argument is a invalid Date" # NoMethodError: undefined method `_iso8601' for Date
77
74
  fails "Date._rfc3339 returns an empty hash if the argument is a invalid Date" # NoMethodError: undefined method `_rfc3339' for Date
78
75
  fails "Date.iso8601 parses YYYY-MM-DD into a Date object" # NoMethodError: undefined method `iso8601' for Date
@@ -0,0 +1,65 @@
1
+ # NOTE: run bin/format-filters after changing this file
2
+ opal_filter "DateTime" do
3
+ fails "DateTime#+ is able to add sub-millisecond precision values" # Expected 0 == 864864 to be truthy but was false
4
+ fails "DateTime#- correctly calculates sub-millisecond time differences" # Expected 0 == 59.000001 to be truthy but was false
5
+ fails "DateTime#- is able to subtract sub-millisecond precision values" # TypeError: TypeError
6
+ fails "DateTime#hour adds 24 to negative hours" # ArgumentError: hour out of range: -10
7
+ fails "DateTime#hour raises an error for Float" # Expected ArgumentError but no exception was raised (1 was returned)
8
+ fails "DateTime#hour raises an error for Rational" # Expected ArgumentError but no exception was raised (#<DateTime:0x74530 @date=-4712-01-01 00:00:00 UTC> was returned)
9
+ fails "DateTime#second adds 60 to negative values" # ArgumentError: sec out of range: -20
10
+ fails "DateTime#second raises an error when minute is given as a rational" # Expected ArgumentError but no exception was raised (#<DateTime:0xa6acc @date=-4712-01-01 00:05:00 UTC> was returned)
11
+ fails "DateTime#second raises an error, when the second is greater or equal than 60" # Expected ArgumentError but no exception was raised (#<DateTime:0xa69da @date=-4712-01-01 00:01:00 UTC> was returned)
12
+ fails "DateTime#strftime returns the timezone with %Z" # Expected "Central European Summer Time" == "+02:00" to be truthy but was false
13
+ fails "DateTime#strftime should be able to print the commercial year with leading zeroes" # Expected "200" == "0200" to be truthy but was false
14
+ fails "DateTime#strftime should be able to print the commercial year with only two digits" # TypeError: no implicit conversion of Range into Integer
15
+ fails "DateTime#strftime should be able to print the datetime with no argument" # ArgumentError: [Time#strftime] wrong number of arguments (given 0, expected 1)
16
+ fails "DateTime#strftime should be able to show a full notation" # Expected "%+" == "Sat Feb 3 04:05:06 +00:00 2001" to be truthy but was false
17
+ fails "DateTime#strftime should be able to show default Logger format" # Expected "2001-12-03T04:05:06.000000 " == "2001-12-03T04:05:06.100000 " to be truthy but was false
18
+ fails "DateTime#strftime should be able to show the commercial week day" # Expected "1" == "7" to be truthy but was false
19
+ fails "DateTime#strftime should be able to show the number of seconds since the unix epoch" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
20
+ fails "DateTime#strftime should be able to show the timezone of the date with a : separator" # Expected "+0200" == "+0000" to be truthy but was false
21
+ fails "DateTime#strftime should be able to show the timezone with a : separator" # Expected "Central European Standard Time" == "+00:00" to be truthy but was false
22
+ fails "DateTime#strftime should be able to show the week number with the week starting on Sunday (%U) and Monday (%W)" # Expected "%U" == "14" to be truthy but was false
23
+ fails "DateTime#strftime shows the number of milliseconds since epoch" # Expected "%Q" == "0" to be truthy but was false
24
+ fails "DateTime#strftime with %L formats the milliseconds of the second" # Expected "000" == "100" to be truthy but was false
25
+ fails "DateTime#strftime with %N formats the microseconds of the second with %6N" # Expected "000000" == "042000" to be truthy but was false
26
+ fails "DateTime#strftime with %N formats the milliseconds of the second with %3N" # Expected "000" == "050" to be truthy but was false
27
+ fails "DateTime#strftime with %N formats the nanoseconds of the second with %9N" # Expected "000000000" == "001234000" to be truthy but was false
28
+ fails "DateTime#strftime with %N formats the nanoseconds of the second with %N" # Expected "000000000" == "001234560" to be truthy but was false
29
+ fails "DateTime#strftime with %N formats the picoseconds of the second with %12N" # Expected "000000000000" == "999999999999" to be truthy but was false
30
+ fails "DateTime#strftime with %z formats a UTC time offset as '+0000'" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
31
+ fails "DateTime#strftime with %z formats a local time with negative UTC offset as '-HHMM'" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
32
+ fails "DateTime#strftime with %z formats a local time with positive UTC offset as '+HHMM'" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
33
+ fails "DateTime#strftime with %z formats a time with fixed negative offset as '-HHMM'" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
34
+ fails "DateTime#strftime with %z formats a time with fixed offset as '+/-HH:MM' with ':' specifier" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
35
+ fails "DateTime#strftime with %z formats a time with fixed offset as '+/-HH:MM:SS' with '::' specifier" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
36
+ fails "DateTime#strftime with %z formats a time with fixed positive offset as '+HHMM'" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
37
+ fails "DateTime#to_time preserves the same time regardless of local time or zone" # Expected 180 == 10800 to be truthy but was false
38
+ fails "DateTime.min adds 60 to negative minutes" # ArgumentError: min out of range: -20
39
+ fails "DateTime.min raises an error for Float" # Expected ArgumentError but no exception was raised (#<DateTime:0x1c098 @date=-4712-01-01 00:05:00 UTC> was returned)
40
+ fails "DateTime.min raises an error for Rational" # Expected ArgumentError but no exception was raised (#<DateTime:0x1bee2 @date=-4712-01-01 02:00:00 UTC> was returned)
41
+ fails "DateTime.minute adds 60 to negative minutes" # ArgumentError: min out of range: -20
42
+ fails "DateTime.minute raises an error for Float" # Expected ArgumentError but no exception was raised (#<DateTime:0x365c2 @date=-4712-01-01 00:05:00 UTC> was returned)
43
+ fails "DateTime.minute raises an error for Rational" # Expected ArgumentError but no exception was raised (#<DateTime:0x3669a @date=-4712-01-01 02:00:00 UTC> was returned)
44
+ fails "DateTime.new takes the seventh argument as an offset" # Expected 0.000008101851851851852 == 0.7 to be truthy but was false
45
+ fails "DateTime.now grabs the local timezone" # Expected "+01:00" == "-08:00" to be truthy but was false
46
+ fails "DateTime.parse YYYY-MM-DDTHH:MM:SS format parses YYYY-MM-DDTHH:MM:SS into a DateTime object" # Expected #<DateTime:0x45dd0 @date=2012-11-08 15:43:59 +0100, @start=2299161> == #<DateTime:0x45dd4 @date=2012-11-08 15:43:59 UTC, @start=2299161> to be truthy but was false
47
+ fails "DateTime.parse YYYY-MM-DDTHH:MM:SS format throws an argument error for invalid day values" # Expected ArgumentError but no exception was raised (#<DateTime:0x18d2e @date=NaN-NaN-NaN NaN:NaN:NaN -NaNNaN> was returned)
48
+ fails "DateTime.parse YYYY-MM-DDTHH:MM:SS format throws an argument error for invalid hour values" # Expected ArgumentError but no exception was raised (#<DateTime:0x18e00 @date=NaN-NaN-NaN NaN:NaN:NaN -NaNNaN> was returned)
49
+ fails "DateTime.parse YYYY-MM-DDTHH:MM:SS format throws an argument error for invalid minute values" # Expected ArgumentError but no exception was raised (#<DateTime:0x18ed8 @date=NaN-NaN-NaN NaN:NaN:NaN -NaNNaN> was returned)
50
+ fails "DateTime.parse YYYY-MM-DDTHH:MM:SS format throws an argument error for invalid month values" # Expected ArgumentError but no exception was raised (#<DateTime:0x18c5c @date=NaN-NaN-NaN NaN:NaN:NaN -NaNNaN> was returned)
51
+ fails "DateTime.parse YYYY-MM-DDTHH:MM:SS format throws an argument error for invalid second values" # Expected ArgumentError but no exception was raised (#<DateTime:0x18b8a @date=NaN-NaN-NaN NaN:NaN:NaN -NaNNaN> was returned)
52
+ fails "DateTime.parse parses DD as month day number" # Expected #<DateTime:0x18582 @date=2001-10-01 00:00:00 +0200> == #<DateTime:0x1858a @date=2022-02-10 00:00:00 +0100> to be truthy but was false
53
+ fails "DateTime.parse parses DDD as year day number" # Expected #<DateTime:0x18818 @date=100-01-01 00:00:00 +0124> == #<DateTime:0x18820 @date=2022-04-10 00:00:00 +0200> to be truthy but was false
54
+ fails "DateTime.parse parses MMDD as month and day" # Expected #<DateTime:0x183d0 @date=1108-01-01 00:00:00 +0124> == #<DateTime:0x183d6 @date=2022-11-08 00:00:00 +0100> to be truthy but was false
55
+ fails "DateTime.parse parses YYDDD as year and day number in 1969--2068" # Expected #<DateTime:0x189cc @date=10100-01-01 00:00:00 +0100> == #<DateTime:0x189d0 @date=2010-04-10 00:00:00 +0200> to be truthy but was false
56
+ fails "DateTime.parse parses YYMMDD as year, month and day in 1969--2068" # Expected #<DateTime:0x18216 @date=201023-01-01 00:00:00 +0100> == #<DateTime:0x1821a @date=2020-10-23 00:00:00 +0200> to be truthy but was false
57
+ fails "DateTime.parse parses a day name into a DateTime object" # NoMethodError: undefined method `cwyear' for #<DateTime:0x18808 @date=NaN-NaN-NaN NaN:NaN:NaN -NaNNaN>
58
+ fails "DateTime.parse throws an argument error for a single digit" # Expected ArgumentError but no exception was raised (#<DateTime:0x18738 @date=2001-01-01 00:00:00 +0100> was returned)
59
+ fails "DateTime.parse(.) parses DD.MM.YYYY into a DateTime object" # Expected 10 == 1 to be truthy but was false
60
+ fails "DateTime.parse(.) parses YY.MM.DD into a DateTime object using the year 20YY" # Expected 2007 == 2010 to be truthy but was false
61
+ fails "DateTime.parse(.) parses YY.MM.DD using the year digits as 20YY when given true as additional argument" # ArgumentError: [DateTime.parse] wrong number of arguments (given 2, expected 1)
62
+ fails "DateTime.sec adds 60 to negative values" # ArgumentError: sec out of range: -20
63
+ fails "DateTime.sec raises an error when minute is given as a rational" # Expected ArgumentError but no exception was raised (#<DateTime:0x1bccc @date=-4712-01-01 00:05:00 UTC> was returned)
64
+ fails "DateTime.sec raises an error, when the second is greater or equal than 60" # Expected ArgumentError but no exception was raised (#<DateTime:0x1bdb8 @date=-4712-01-01 00:01:00 UTC> was returned)
65
+ end
@@ -26,24 +26,6 @@ opal_filter "Float" do
26
26
  fails "Float#inspect uses non-e format for a positive value with whole part having 15 significant figures" # Expected "10000000000000" == "10000000000000.0" to be truthy but was false
27
27
  fails "Float#inspect uses non-e format for a positive value with whole part having 16 significant figures" # Expected "100000000000000" == "100000000000000.0" to be truthy but was false
28
28
  fails "Float#negative? on negative zero returns false" # Expected true to be false
29
- fails "Float#next_float gives the same result for -0.0 as for +0.0" # NoMethodError: undefined method `next_float' for 0
30
- fails "Float#next_float returns Float::INFINITY for Float::INFINITY" # NoMethodError: undefined method `next_float' for Infinity
31
- fails "Float#next_float returns NAN if NAN was the receiver"
32
- fails "Float#next_float returns a float the smallest possible step greater than the receiver"
33
- fails "Float#next_float returns negative zero when stepping upward from just below zero"
34
- fails "Float#next_float reverses the effect of prev_float for all Floats except INFINITY and +0.0" # NoMethodError: undefined method `prev_float' for -0.739980680635199
35
- fails "Float#next_float steps directly between -1.0 and -1.0 + EPSILON/2"
36
- fails "Float#next_float steps directly between 1.0 and 1.0 + EPSILON"
37
- fails "Float#next_float steps directly between MAX and INFINITY"
38
- fails "Float#prev_float gives the same result for -0.0 as for +0.0" # NoMethodError: undefined method `prev_float' for 0
39
- fails "Float#prev_float returns -Float::INFINITY for -Float::INFINITY" # NoMethodError: undefined method `prev_float' for -Infinity
40
- fails "Float#prev_float returns NAN if NAN was the receiver"
41
- fails "Float#prev_float returns a float the smallest possible step smaller than the receiver"
42
- fails "Float#prev_float returns positive zero when stepping downward from just above zero"
43
- fails "Float#prev_float reverses the effect of next_float for all Floats except -INFINITY and -0.0" # NoMethodError: undefined method `next_float' for 0.7192216026596725
44
- fails "Float#prev_float steps directly between -1.0 and -1.0 - EPSILON"
45
- fails "Float#prev_float steps directly between 1.0 and 1.0 - EPSILON/2"
46
- fails "Float#prev_float steps directly between MAX and INFINITY"
47
29
  fails "Float#rationalize returns self as a simplified Rational with no argument" # precision errors caused by Math.frexp and Math.ldexp
48
30
  fails "Float#round raise for a non-existent round mode" # TypeError: no implicit conversion of Hash into Integer
49
31
  fails "Float#round raises FloatDomainError for exceptional values with a half option" # TypeError: no implicit conversion of Hash into Integer
@@ -9,7 +9,6 @@ opal_filter "Hash" do
9
9
  fails "Hash#[]= does not dispatch to hash for Boolean, Integer, Float, String, or Symbol" # NoMethodError: undefined method `insert' for "rubyexe.rb"
10
10
  fails "Hash#[]= keeps the existing String key in the hash if there is a matching one" # Expected "foo" not to be identical to "foo"
11
11
  fails "Hash#compare_by_identity gives different identity for string literals" # Expected [2] to equal [1, 2]
12
- fails "Hash#delete allows removing a key while iterating" # Exception: Cannot read property '$$is_string' of undefined
13
12
  fails "Hash#each always yields an Array of 2 elements, even when given a callable of arity 2" # Expected ArgumentError but no exception was raised ({"a"=>1} was returned)
14
13
  fails "Hash#each_pair always yields an Array of 2 elements, even when given a callable of arity 2" # Expected ArgumentError but no exception was raised ({"a"=>1} was returned)
15
14
  fails "Hash#eql? compares keys with eql? semantics" # spec relies on integer and float being different
@@ -23,7 +22,6 @@ opal_filter "Hash" do
23
22
  fails "Hash#invert compares new keys with eql? semantics" # spec relies on integer and float being different
24
23
  fails "Hash#rehash removes duplicate keys for large hashes" # Expected 102 == 101 to be truthy but was false
25
24
  fails "Hash#rehash removes duplicate keys" # Expected 2 to equal 1
26
- fails "Hash#shift allows shifting entries while iterating" # Exception: Cannot read property '$$is_string' of undefined
27
25
  fails "Hash#store does not dispatch to hash for Boolean, Integer, Float, String, or Symbol" # NoMethodError: undefined method `insert' for "rubyexe.rb"
28
26
  fails "Hash#store keeps the existing String key in the hash if there is a matching one" # Expected "foo" not to be identical to "foo"
29
27
  fails "Hash#to_h with block does not coerce returned pair to Array with #to_a" # Expected TypeError (/wrong element type MockObject/) but no exception was raised ({"a"=>1} was returned)
@@ -213,7 +213,6 @@ opal_filter "language" do
213
213
  fails "Predefined global $~ raises an error if assigned an object not nil or instanceof MatchData"
214
214
  fails "Ruby String interpolation returns a string with the source encoding by default" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
215
215
  fails "Ruby String interpolation returns a string with the source encoding, even if the components have another encoding" # ArgumentError: unknown encoding name - euc-jp
216
- fails "Safe navigator allows assignment methods"
217
216
  fails "The ** operator hash with omitted value accepts mixed syntax" # NameError: uninitialized constant MSpecEnv::a
218
217
  fails "The ** operator hash with omitted value accepts short notation 'key' for 'key: value' syntax" # NameError: uninitialized constant MSpecEnv::a
219
218
  fails "The ** operator hash with omitted value ignores hanging comma on short notation" # NameError: uninitialized constant MSpecEnv::a
@@ -285,8 +284,6 @@ opal_filter "language" do
285
284
  fails "The redo statement in a method is invalid and raises a SyntaxError" # Expected SyntaxError but no exception was raised ("m" was returned)
286
285
  fails "The redo statement triggers ensure block when re-executing a block"
287
286
  fails "The rescue keyword allows rescue in 'do end' block" # NoMethodError: undefined method `call' for nil
288
- fails "The rescue keyword can capture the raised exception using a setter method" # NoMethodError: undefined method `message' for nil
289
- fails "The rescue keyword can capture the raised exception using a square brackets setter" # ArgumentError: [SquareBracketsCaptor#[]=] wrong number of arguments(1 for 2)
290
287
  fails "The rescue keyword inline form can be inlined" # Expected Infinity to equal 1
291
288
  fails "The rescue keyword only accepts Module or Class in rescue clauses" # RuntimeError: error
292
289
  fails "The rescue keyword only accepts Module or Class in splatted rescue clauses" # RuntimeError: error
@@ -37,7 +37,6 @@ opal_filter "Marshal" do
37
37
  fails "Marshal.load for an Object loads an Object with a non-US-ASCII instance variable" # NameError: '@é' is not allowed as an instance variable name
38
38
  fails "Marshal.load for an Object raises ArgumentError if the object from an 'o' stream is not dumpable as 'o' type user class" # Expected ArgumentError but no exception was raised (#<File:0x3b160> was returned)
39
39
  fails "Marshal.load for an object responding to #marshal_dump and #marshal_load loads a user-marshaled object" # Expected "\x04\b[\aU:\x10UserMarshal\"\tdata@\x06" == "\x04\b[\aU:\x10UserMarshal:\tdata;\x06" to be truthy but was false
40
- fails "Marshal.load loads a Regexp" # anchors difference
41
40
  fails "Marshal.load loads an array containing objects having _dump method, and with proc"
42
41
  fails "Marshal.load loads an array containing objects having marshal_dump method, and with proc"
43
42
  fails "Marshal.load when a class does not exist in the namespace raises an ArgumentError" # an issue with constant resolving, e.g. String::Array
@@ -47,7 +47,6 @@ opal_filter "String" do
47
47
  fails "String#% supports inspect formats using %p" # Expected "{\"capture\"=>1}" to equal "{:capture=>1}"
48
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"
49
49
  fails "String#* raises a RangeError when given integer is a Bignum" # Expected RangeError but no exception was raised ("" was returned)
50
- fails "String#* returns String instances" # Expected "" (MyString) to be an instance of String
51
50
  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
51
  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
52
  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
@@ -64,20 +63,14 @@ opal_filter "String" do
64
63
  fails "String#[] raises a RangeError if the index is too big" # Expected RangeError but no exception was raised (nil was returned)
65
64
  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)
66
65
  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)
67
- fails "String#[] with Range returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
68
- fails "String#[] with Regexp returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
69
- fails "String#[] with Regexp, index returns String instances" # Expected "he" (StringSpecs::MyString) to be an instance of String
70
66
  fails "String#[] with String returns a String instance when given a subclass instance" # Expected "el" (StringSpecs::MyString) to be an instance of String
71
67
  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)
72
- fails "String#[] with index, length returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
73
68
  fails "String#[] with index, length returns a string with the same encoding" # ArgumentError: unknown encoding name - ISO-8859-1
74
69
  fails "String#bytes yields each byte to a block if one is given, returning self" # Expected [113, 103, 172, 78] to equal "東京"
75
70
  fails "String#byteslice raises a RangeError if the index is too big" # Expected RangeError but no exception was raised (nil was returned)
76
71
  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)
77
72
  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)
78
- fails "String#byteslice with Range returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
79
73
  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)
80
- fails "String#byteslice with index, length returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
81
74
  fails "String#byteslice with index, length returns a string with the same encoding" # ArgumentError: unknown encoding name - ISO-8859-1
82
75
  fails "String#capitalize ASCII-only case mapping does not capitalize non-ASCII characters" # ArgumentError: [String#capitalize] wrong number of arguments(1 for 0)
83
76
  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(2 for 0)
@@ -86,30 +79,22 @@ opal_filter "String" do
86
79
  fails "String#capitalize full Unicode case mapping adapted for Turkic languages capitalizes ASCII characters according to Turkic semantics" # ArgumentError: [String#capitalize] wrong number of arguments(1 for 0)
87
80
  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"
88
81
  fails "String#capitalize full Unicode case mapping updates string metadata" # Expected "SSet" to equal "Sset"
89
- fails "String#capitalize returns String instances when called on a subclass" # Expected "Hello" (StringSpecs::MyString) to be an instance of String
90
82
  fails "String#casecmp independent of case returns nil if incompatible encodings" # NameError: uninitialized constant Encoding::EUC_JP
91
83
  fails "String#casecmp? independent of case case folds" # Expected false to be true
92
84
  fails "String#casecmp? independent of case for UNICODE characters returns true when downcase(:fold) on unicode" # Expected false to equal true
93
85
  fails "String#casecmp? independent of case in UTF-8 mode for non-ASCII characters returns true when they are the same with normalized case" # Expected false to equal true
94
86
  fails "String#casecmp? independent of case returns nil if incompatible encodings" # NameError: uninitialized constant Encoding::EUC_JP
95
- fails "String#center with length, padding returns String instances when called on subclasses" # Expected " " (StringSpecs::MyString) to be an instance of String
96
- 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
97
87
  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"
98
- fails "String#chop returns String instances when called on a subclass" # Expected "hello" (StringSpecs::MyString) to be an instance of String
99
88
  fails "String#clone calls #initialize_copy on the new instance" # Expected nil to equal "string"
100
89
  fails "String#clone copies singleton methods" # NoMethodError: undefined method `special' for "string"
101
90
  fails "String#concat when self is BINARY and argument is US-ASCII uses BINARY encoding" # NoMethodError: undefined method `concat' for "abc"
102
91
  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 ""
103
- fails "String#delete returns String instances when called on a subclass" # Expected "oh no" (StringSpecs::MyString) to be an instance of String
104
- fails "String#delete_prefix returns a String instance when called on a subclass instance" # Expected "o" (StringSpecs::MyString) to be an instance of String
105
- fails "String#delete_suffix returns a String instance when called on a subclass instance" # Expected "h" (StringSpecs::MyString) to be an instance of String
106
92
  fails "String#downcase ASCII-only case mapping does not downcase non-ASCII characters" # ArgumentError: [String#downcase] wrong number of arguments(1 for 0)
107
93
  fails "String#downcase case folding case folds special characters" # ArgumentError: [String#downcase] wrong number of arguments(1 for 0)
108
94
  fails "String#downcase full Unicode case mapping adapted for Lithuanian allows Turkic as an extra option (and applies Turkic semantics)" # ArgumentError: [String#downcase] wrong number of arguments(2 for 0)
109
95
  fails "String#downcase full Unicode case mapping adapted for Lithuanian currently works the same as full Unicode case mapping" # ArgumentError: [String#downcase] wrong number of arguments(1 for 0)
110
96
  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)
111
97
  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)
112
- fails "String#downcase returns a String instance for subclasses" # Expected "foobar" (StringSpecs::MyString) to be an instance of String
113
98
  fails "String#dump does not take into account if a string is frozen" # NoMethodError: undefined method `dump' for "foo"
114
99
  fails "String#dump includes .force_encoding(name) if the encoding isn't ASCII compatible" # NoMethodError: undefined method `dump' for "ࡶ"
115
100
  fails "String#dump keeps origin encoding" # ArgumentError: unknown encoding name - ISO-8859-1
@@ -163,7 +148,6 @@ opal_filter "String" do
163
148
  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
164
149
  fails "String#gsub with pattern and replacement doesn't freak out when replacing ^" # Expected " Text " == " Text " to be truthy but was false
165
150
  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])"
166
- fails "String#gsub with pattern and replacement returns String instances when called on a subclass" # Expected "" (StringSpecs::MyString) to be an instance of String
167
151
  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
168
152
  fails "String#include? with String raises an Encoding::CompatibilityError if the encodings are incompatible" # NameError: uninitialized constant Encoding::EUC_JP
169
153
  fails "String#inspect returns a string with non-printing characters replaced by \\x notation" # Expected "\"\\xA0\"" to be computed by " ".inspect (computed "\" \"" instead)
@@ -178,10 +162,7 @@ opal_filter "String" do
178
162
  fails "String#length adds 1 (and not 2) for a incomplete surrogate in UTF-16" # Expected 2 == 1 to be truthy but was false
179
163
  fails "String#length adds 1 for a broken sequence in UTF-32" # Expected 4 == 1 to be truthy but was false
180
164
  fails "String#length returns the correct length after force_encoding(BINARY)" # Expected 2 == 4 to be truthy but was false
181
- fails "String#ljust with length, padding returns String instances when called on subclasses" # Expected " " (StringSpecs::MyString) to be an instance of String
182
- fails "String#next returns String instances when called on a subclass" # Expected "" (StringSpecs::MyString) to be an instance of String
183
165
  fails "String#partition with String returns String instances when called on a subclass" # Expected "hello" (StringSpecs::MyString) to be an instance of String
184
- fails "String#rjust with length, padding returns String instances when called on subclasses" # Expected " " (StringSpecs::MyString) to be an instance of String
185
166
  fails "String#rpartition with String returns String instances when called on a subclass" # Expected "hello" (StringSpecs::MyString) to be an instance of String
186
167
  fails "String#rpartition with String returns new object if doesn't match" # Expected "hello".equal? "hello" to be falsy but was true
187
168
  fails "String#size adds 1 (and not 2) for a incomplete surrogate in UTF-16" # Expected 2 == 1 to be truthy but was false
@@ -190,12 +171,8 @@ opal_filter "String" do
190
171
  fails "String#slice raises a RangeError if the index is too big" # Expected RangeError but no exception was raised (nil was returned)
191
172
  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)
192
173
  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)
193
- fails "String#slice with Range returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
194
- fails "String#slice with Regexp returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
195
- fails "String#slice with Regexp, index returns String instances" # Expected "he" (StringSpecs::MyString) to be an instance of String
196
174
  fails "String#slice with String returns a String instance when given a subclass instance" # Expected "el" (StringSpecs::MyString) to be an instance of String
197
175
  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)
198
- fails "String#slice with index, length returns String instances" # Expected "" (StringSpecs::MyString) to be an instance of String
199
176
  fails "String#slice with index, length returns a string with the same encoding" # ArgumentError: unknown encoding name - ISO-8859-1
200
177
  fails "String#split with Regexp allows concurrent Regexp calls in a shared context" # NotImplementedError: Thread creation not available
201
178
  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"]
@@ -213,11 +190,8 @@ opal_filter "String" do
213
190
  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
214
191
  fails "String#split with String returns String instances based on self" # Expected "x" (StringSpecs::MyString) to be an instance of String
215
192
  fails "String#split with String when $; is not nil warns" # Expected warning to match: /warning: \$; is set to non-nil value/ but got: ""
216
- fails "String#squeeze returns String instances when called on a subclass" # Expected "oh no!" (StringSpecs::MyString) to be an instance of String
217
- fails "String#sub with pattern, replacement returns String instances when called on a subclass" # Expected "" (StringSpecs::MyString) to be an instance of String
218
193
  fails "String#sub with pattern, replacement returns a copy of self when no modification is made" # Expected "hello" not to be identical to "hello"
219
194
  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
220
- fails "String#succ returns String instances when called on a subclass" # Expected "" (StringSpecs::MyString) to be an instance of String
221
195
  fails "String#swapcase ASCII-only case mapping does not swapcase non-ASCII characters" # ArgumentError: [String#swapcase] wrong number of arguments(1 for 0)
222
196
  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)
223
197
  fails "String#swapcase full Unicode case mapping adapted for Lithuanian currently works the same as full Unicode case mapping" # ArgumentError: [String#swapcase] wrong number of arguments(1 for 0)
@@ -225,14 +199,11 @@ opal_filter "String" do
225
199
  fails "String#swapcase full Unicode case mapping adapted for Turkic languages swaps case of ASCII characters according to Turkic semantics" # ArgumentError: [String#swapcase] wrong number of arguments(1 for 0)
226
200
  fails "String#swapcase full Unicode case mapping updates string metadata" # Expected "aßET" to equal "aSSET"
227
201
  fails "String#swapcase full Unicode case mapping works for all of Unicode with no option" # Expected "äÖü" to equal "ÄöÜ"
228
- fails "String#swapcase returns String instances when called on a subclass" # Expected "" (StringSpecs::MyString) to be an instance of String
229
202
  fails "String#to_sym raises an EncodingError for UTF-8 String containing invalid bytes" # Expected true to equal false
230
203
  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)>
231
204
  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)>
232
205
  fails "String#to_sym returns a UTF-16LE Symbol for a UTF-16LE String containing non US-ASCII characters" # ERROR
233
206
  fails "String#to_sym returns a binary Symbol for a binary String containing non US-ASCII characters" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT (dummy)>
234
- fails "String#tr returns Stringinstances when called on a subclass" # Expected "hallo" (StringSpecs::MyString) to be an instance of String
235
- fails "String#tr_s returns String instances when called on a subclass" # Expected "hallo" (StringSpecs::MyString) to be an instance of String
236
207
  fails "String#undump Limitations cannot undump non ASCII-compatible string" # NoMethodError: undefined method `undump' for "\"foo\""
237
208
  fails "String#undump always returns String instance" # NoMethodError: undefined method `undump' for "\"foo\""
238
209
  fails "String#undump does not take into account if a string is frozen" # NoMethodError: undefined method `undump' for "\"foo\""
@@ -271,7 +242,6 @@ opal_filter "String" do
271
242
  fails "String#upcase full Unicode case mapping adapted for Lithuanian currently works the same as full Unicode case mapping" # ArgumentError: [String#upcase] wrong number of arguments(1 for 0)
272
243
  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)
273
244
  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)
274
- fails "String#upcase returns a String instance for subclasses" # Expected "FOOBAR" (StringSpecs::MyString) to be an instance of String
275
245
  fails "String#valid_encoding? returns true for IBM720 encoding self is valid in" # ArgumentError: unknown encoding name - IBM720
276
246
  fails "String.new accepts an encoding argument" # ArgumentError: [String.new] wrong number of arguments(2 for -1)
277
247
  fails "String.new is called on subclasses" # Expected nil to equal "subclass"