opal 1.4.1 → 1.5.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (89) hide show
  1. checksums.yaml +4 -4
  2. data/.eslintrc.js +5 -3
  3. data/.rubocop.yml +1 -0
  4. data/UNRELEASED.md +37 -2
  5. data/benchmark-ips/bm_js_symbols_vs_strings.rb +39 -14
  6. data/docs/releasing.md +10 -2
  7. data/lib/opal/ast/matcher.rb +77 -0
  8. data/lib/opal/cache.rb +1 -1
  9. data/lib/opal/cli_runners/applescript.rb +2 -0
  10. data/lib/opal/compiler.rb +18 -9
  11. data/lib/opal/nodes/call.rb +73 -28
  12. data/lib/opal/nodes/def.rb +31 -27
  13. data/lib/opal/nodes/definitions.rb +2 -0
  14. data/lib/opal/nodes/helpers.rb +4 -23
  15. data/lib/opal/nodes/if.rb +222 -0
  16. data/lib/opal/nodes/iter.rb +41 -37
  17. data/lib/opal/nodes/literal.rb +2 -2
  18. data/lib/opal/nodes/masgn.rb +15 -17
  19. data/lib/opal/nodes/node_with_args/shortcuts.rb +100 -0
  20. data/lib/opal/nodes/node_with_args.rb +1 -0
  21. data/lib/opal/nodes/top.rb +26 -10
  22. data/lib/opal/nodes.rb +0 -1
  23. data/lib/opal/parser/default_config.rb +3 -2
  24. data/lib/opal/repl.rb +1 -1
  25. data/lib/opal/rewriter.rb +13 -6
  26. data/lib/opal/rewriters/base.rb +12 -1
  27. data/lib/opal/rewriters/rubyspec/filters_rewriter.rb +1 -0
  28. data/lib/opal/version.rb +1 -1
  29. data/opal/corelib/array.rb +23 -28
  30. data/opal/corelib/binding.rb +14 -4
  31. data/opal/corelib/constants.rb +3 -3
  32. data/opal/corelib/hash.rb +2 -2
  33. data/opal/corelib/irb.rb +192 -0
  34. data/opal/corelib/math/polyfills.rb +127 -0
  35. data/opal/corelib/math.rb +14 -194
  36. data/opal/corelib/module.rb +23 -25
  37. data/opal/corelib/number.rb +63 -14
  38. data/opal/corelib/regexp.rb +2 -0
  39. data/opal/corelib/runtime.js +56 -20
  40. data/opal/corelib/string.rb +38 -59
  41. data/opal/corelib/time.rb +106 -68
  42. data/opal/opal/full.rb +0 -1
  43. data/opal/opal.rb +4 -1
  44. data/spec/filters/bugs/date.rb +0 -3
  45. data/spec/filters/bugs/datetime.rb +65 -0
  46. data/spec/filters/bugs/float.rb +0 -18
  47. data/spec/filters/bugs/hash.rb +0 -2
  48. data/spec/filters/bugs/language.rb +0 -3
  49. data/spec/filters/bugs/marshal.rb +0 -1
  50. data/spec/filters/bugs/string.rb +0 -30
  51. data/spec/filters/bugs/time.rb +18 -8
  52. data/spec/lib/cli_spec.rb +2 -2
  53. data/spec/lib/compiler_spec.rb +8 -8
  54. data/spec/lib/rewriters/base_spec.rb +1 -1
  55. data/spec/lib/rewriters/binary_operator_assignment_spec.rb +34 -59
  56. data/spec/lib/rewriters/block_to_iter_spec.rb +3 -6
  57. data/spec/lib/rewriters/dot_js_syntax_spec.rb +2 -5
  58. data/spec/lib/rewriters/for_rewriter_spec.rb +0 -1
  59. data/spec/lib/rewriters/forward_args_spec.rb +2 -3
  60. data/spec/lib/rewriters/js_reserved_words_spec.rb +2 -15
  61. data/spec/lib/rewriters/logical_operator_assignment_spec.rb +64 -89
  62. data/spec/lib/rewriters/numblocks_spec.rb +3 -5
  63. data/spec/lib/rewriters/opal_engine_check_spec.rb +2 -14
  64. data/spec/lib/rewriters/rubyspec/filters_rewriter_spec.rb +10 -2
  65. data/spec/opal/compiler/irb_spec.rb +4 -0
  66. data/spec/opal/core/language/super_spec.rb +26 -0
  67. data/spec/opal/core/regexp/assertions_spec.rb +19 -0
  68. data/spec/opal/core/string/to_proc_spec.rb +19 -0
  69. data/spec/ruby_specs +4 -0
  70. data/spec/support/rewriters_helper.rb +43 -23
  71. data/stdlib/date/date_time.rb +71 -0
  72. data/stdlib/date/formatters.rb +28 -0
  73. data/stdlib/date/infinity.rb +73 -0
  74. data/stdlib/date.rb +77 -214
  75. data/stdlib/opal/repl_js.rb +1 -1
  76. data/stdlib/{opal/replutils.rb → opal-replutils.rb} +3 -3
  77. data/stdlib/time.rb +39 -2
  78. data/stdlib/uri.rb +53 -0
  79. data/tasks/performance/asciidoctor_test.rb.erb +3 -1
  80. data/tasks/performance/optimization_status.rb +3 -2
  81. data/tasks/performance.rake +69 -35
  82. data/tasks/testing.rake +1 -0
  83. data/test/opal/test_uri.rb +35 -0
  84. data/yarn.lock +27 -5
  85. metadata +31 -18
  86. data/lib/opal/nodes/csend.rb +0 -24
  87. data/lib/opal/rewriters/explicit_writer_return.rb +0 -59
  88. data/spec/lib/rewriters/explicit_writer_return_spec.rb +0 -186
  89. data/stdlib/nodejs/irb.rb +0 -43
@@ -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"
@@ -25,7 +25,6 @@ opal_filter "Time" do
25
25
  fails "Time#getlocal with a timezone argument subject's class implements .find_timezone method does not call .find_timezone if passed any not string/numeric/timezone timezone argument" # Expected TypeError (/can't convert \w+ into an exact number/) but got: NoMethodError (undefined method `getlocal' for 2000-01-01 12:00:00 UTC)
26
26
  fails "Time#gmtime converts self to UTC, modifying the receiver" # Expected 2007-01-09 03:00:00 UTC to equal 2007-01-09 12:00:00 UTC
27
27
  fails "Time#hash returns an Integer" # Expected "Time:100000" (String) to be an instance of Integer
28
- fails "Time#inspect formats the fixed offset time following the pattern 'yyyy-MM-dd HH:mm:ss +/-HHMM'"
29
28
  fails "Time#inspect omits trailing zeros from microseconds" # Expected "2007-11-01 15:25:00 UTC" == "2007-11-01 15:25:00.1 UTC" to be truthy but was false
30
29
  fails "Time#inspect preserves microseconds" # Expected "2007-11-01 15:25:00 UTC" == "2007-11-01 15:25:00.123456 UTC" to be truthy but was false
31
30
  fails "Time#inspect preserves nanoseconds" # Expected "2007-11-01 15:25:00 UTC" == "2007-11-01 15:25:00.123456789 UTC" to be truthy but was false
@@ -44,7 +43,6 @@ opal_filter "Time" do
44
43
  fails "Time#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
45
44
  fails "Time#strftime should be able to show the commercial week day"
46
45
  fails "Time#strftime should be able to show the number of seconds since the unix epoch" # fails under FIJI et al TZs
47
- fails "Time#strftime should be able to show the timezone if available"
48
46
  fails "Time#strftime should be able to show the timezone of the date with a : separator"
49
47
  fails "Time#strftime should be able to show the week number with the week starting on Sunday (%U) and Monday (%W)"
50
48
  fails "Time#strftime with %N formats the microseconds of the second with %6N"
@@ -53,9 +51,13 @@ opal_filter "Time" do
53
51
  fails "Time#strftime with %N formats the nanoseconds of the second with %N"
54
52
  fails "Time#strftime with %N formats the picoseconds of the second with %12N"
55
53
  fails "Time#subsec returns 0 as an Integer for a Time with a whole number of seconds" # NoMethodError: undefined method `subsec' for 1970-01-01 01:01:40 +0100
54
+ fails "Time#to_date yields accurate julian date for Julian-Gregorian gap value" # Expected 2299170 == 2299160 to be truthy but was false
55
+ fails "Time#to_date yields accurate julian date for ambiguous pre-Gregorian reform value" # Expected 2299160 == 2299150 to be truthy but was false
56
+ fails "Time#to_date yields accurate julian date for post-Gregorian reform value" # Expected 2299171 == 2299161 to be truthy but was false
57
+ fails "Time#to_date yields same julian day regardless of UTC time value" # Expected 2299171 == 2299161 to be truthy but was false
58
+ fails "Time#to_date yields same julian day regardless of local time or zone" # Expected 2299171 == 2299161 to be truthy but was false
56
59
  fails "Time#to_f returns the float number of seconds + usecs since the epoch"
57
60
  fails "Time#to_i rounds fractional seconds toward zero" # Expected -315619200 == -315619199 to be truthy but was false
58
- fails "Time#to_s formats the fixed offset time following the pattern 'yyyy-MM-dd HH:mm:ss +/-HHMM'"
59
61
  fails "Time#tv_sec rounds fractional seconds toward zero" # Expected -315619200 == -315619199 to be truthy but was false
60
62
  fails "Time#usec returns a positive value for dates before the epoch" # Expected 0 to equal 404240
61
63
  fails "Time#utc converts self to UTC, modifying the receiver" # Expected 2007-01-09 03:00:00 UTC to equal 2007-01-09 12:00:00 UTC
@@ -77,6 +79,7 @@ opal_filter "Time" do
77
79
  fails "Time.at passed non-Time, non-Numeric with an argument that responds to #to_r needs for the argument to respond to #to_int too" # Mock 'rational-but-no-to_int' expected to receive to_r("any_args") exactly 1 times but received it 0 times
78
80
  fails "Time.gm handles fractional usec close to rounding limit" # NoMethodError: undefined method `nsec' for 2000-01-01 12:30:00 UTC:Time
79
81
  fails "Time.gm raises an ArgumentError for out of range microsecond" # Expected ArgumentError but no exception was raised (2000-01-01 20:15:01 UTC was returned)
82
+ fails "Time.httpdate parses RFC-2616 strings" # NoMethodError: undefined method `httpdate' for Time
80
83
  fails "Time.local raises an ArgumentError for out of range microsecond" # Expected ArgumentError but no exception was raised (2000-01-01 20:15:01 +0200 was returned)
81
84
  fails "Time.mktime raises an ArgumentError for out of range microsecond" # Expected ArgumentError but no exception was raised (2000-01-01 20:15:01 +0200 was returned)
82
85
  fails "Time.new has at least microsecond precision" # NoMethodError: undefined method `nsec' for 2019-05-16 23:25:01 +0200
@@ -85,12 +88,12 @@ opal_filter "Time" do
85
88
  fails "Time.new with a timezone argument #name method uses the optional #name method for marshaling" # ArgumentError: Opal does not support explicitly specifying UTC offset for Time
86
89
  fails "Time.new with a timezone argument Time-like argument of #utc_to_local and #local_to_utc methods has attribute values the same as a Time object in UTC" # ArgumentError: Opal does not support explicitly specifying UTC offset for Time
87
90
  fails "Time.new with a timezone argument Time-like argument of #utc_to_local and #local_to_utc methods implements subset of Time methods" # ArgumentError: Opal does not support explicitly specifying UTC offset for Time
88
- fails "Time.new with a timezone argument accepts timezone argument that must have #local_to_utc and #utc_to_local methods" # Expected to not get Exception but got: ArgumentError (Opal does not support explicitly specifying UTC offset for Time)
89
- fails "Time.new with a timezone argument does not raise exception if timezone does not implement #utc_to_local method" # Expected to not get Exception but got: ArgumentError (Opal does not support explicitly specifying UTC offset for Time)
91
+ fails "Time.new with a timezone argument accepts timezone argument that must have #local_to_utc and #utc_to_local methods" # Expected to not get Exception but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
92
+ fails "Time.new with a timezone argument does not raise exception if timezone does not implement #utc_to_local method" # Expected to not get Exception but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
90
93
  fails "Time.new with a timezone argument raises TypeError if timezone does not implement #local_to_utc method" # Expected TypeError (/can't convert \w+ into an exact number/) but got: ArgumentError (Opal does not support explicitly specifying UTC offset for Time)
91
- fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could be Time instance" # Expected to not get Exception but got: ArgumentError (Opal does not support explicitly specifying UTC offset for Time)
92
- fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could be Time subclass instance" # Expected to not get Exception but got: ArgumentError (Opal does not support explicitly specifying UTC offset for Time)
93
- fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could be any object with #to_i method" # Expected to not get Exception but got: ArgumentError (Opal does not support explicitly specifying UTC offset for Time)
94
+ fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could be Time instance" # Expected to not get Exception but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
95
+ fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could be Time subclass instance" # Expected to not get Exception but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
96
+ fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could be any object with #to_i method" # Expected to not get Exception but got: ArgumentError (Opal doesn't support other types for a timezone argument than Integer and String)
94
97
  fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods could have any #zone and #utc_offset because they are ignored" # ArgumentError: Opal does not support explicitly specifying UTC offset for Time
95
98
  fails "Time.new with a timezone argument returned value by #utc_to_local and #local_to_utc methods leads to raising Argument error if difference between argument and result is too large" # Expected ArgumentError (utc_offset out of range) but got: ArgumentError (Opal does not support explicitly specifying UTC offset for Time)
96
99
  fails "Time.new with a timezone argument returns a Time in the timezone" # ArgumentError: Opal does not support explicitly specifying UTC offset for Time
@@ -98,10 +101,17 @@ opal_filter "Time" do
98
101
  fails "Time.new with a timezone argument subject's class implements .find_timezone method calls .find_timezone to build a time object if passed zone name as a timezone argument" # ArgumentError: Opal does not support explicitly specifying UTC offset for Time
99
102
  fails "Time.new with a timezone argument subject's class implements .find_timezone method does not call .find_timezone if passed any not string/numeric/timezone timezone argument" # Expected TypeError (/can't convert \w+ into an exact number/) but got: ArgumentError (Opal does not support explicitly specifying UTC offset for Time)
100
103
  fails "Time.new with a timezone argument the #abbr method is used by '%Z' in #strftime" # ArgumentError: Opal does not support explicitly specifying UTC offset for Time
104
+ fails "Time.new with a utc_offset argument raises ArgumentError if the String argument is not in an ASCII-compatible encoding" # Expected ArgumentError but no exception was raised (1999-12-31 18:50:00 -0410.000000000000028 was returned)
101
105
  fails "Time.new with a utc_offset argument raises ArgumentError if the month is greater than 12" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (Opal does not support explicitly specifying UTC offset for Time)
106
+ fails "Time.new with a utc_offset argument raises ArgumentError if the utc_offset argument is greater than or equal to 10e9" # Expected ArgumentError but no exception was raised (2031-09-09 00:46:40 +27777746.66666666418314 was returned)
102
107
  fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as +HH:MM:SS" # ArgumentError: Opal does not support explicitly specifying UTC offset for Time
103
108
  fails "Time.now has at least microsecond precision" # NoMethodError: undefined method `nsec' for 2019-05-16 23:25:03 +0200
104
109
  fails "Time.now uses the local timezone" # Expected 10800 to equal -28800
110
+ fails "Time.rfc2822 parses RFC-2822 strings" # NoMethodError: undefined method `rfc2822' for Time
111
+ fails "Time.rfc2822 parses RFC-822 strings" # NoMethodError: undefined method `rfc2822' for Time
112
+ fails "Time.rfc822 parses RFC-2822 strings" # NoMethodError: undefined method `rfc2822' for Time
113
+ fails "Time.rfc822 parses RFC-822 strings" # NoMethodError: undefined method `rfc2822' for Time
105
114
  fails "Time.utc handles fractional usec close to rounding limit" # NoMethodError: undefined method `nsec' for 2000-01-01 12:30:00 UTC:Time
106
115
  fails "Time.utc raises an ArgumentError for out of range microsecond" # Expected ArgumentError but no exception was raised (2000-01-01 20:15:01 UTC was returned)
116
+ fails "Time.xmlschema parses ISO-8601 strings" # NoMethodError: undefined method `xmlschema' for Time
107
117
  end
data/spec/lib/cli_spec.rb CHANGED
@@ -84,7 +84,7 @@ RSpec.describe Opal::CLI do
84
84
  context 'when false' do
85
85
  let(:options) { {lib_only: false, runner: :compiler, evals: [''], skip_opal_require: true, no_exit: true} }
86
86
  it 'appends an empty code block at the end of the source' do
87
- expect_output_of{ subject.run }.to include("function(Opal)")
87
+ expect_output_of{ subject.run }.to include("Opal.nil")
88
88
  end
89
89
  end
90
90
 
@@ -207,7 +207,7 @@ RSpec.describe Opal::CLI do
207
207
  describe ':sexp option' do
208
208
  let(:options) { {evals: ['puts 4'], sexp: true} }
209
209
  it 'prints syntax expressions for the given code' do
210
- expect_output_of{ subject.run }.to eq("s(:send, nil, :puts,\n s(:int, 4))\n")
210
+ expect_output_of{ subject.run }.to eq("s(:top,\n s(:send, nil, :puts,\n s(:int, 4)))\n")
211
211
  end
212
212
  end
213
213
 
@@ -17,15 +17,15 @@ RSpec.describe Opal::Compiler do
17
17
 
18
18
  describe 'requirable' do
19
19
  it 'executes the file' do
20
- expect_compiled("").to include('(function(Opal) {')
21
- expect_compiled("").to start_with('Opal.queue(function(Opal) {')
22
- expect_compiled("").to end_with("});\n")
20
+ expect_compiled("true").to include('(function(Opal) {')
21
+ expect_compiled("true").to start_with('Opal.queue(function(Opal) {')
22
+ expect_compiled("true").to end_with("});\n")
23
23
  end
24
24
 
25
25
  it 'puts the compiled into "Opal.modules"' do
26
26
  options = { :requirable => true, :file => "pippo" }
27
- expect_compiled("", options).to include('Opal.modules["pippo"] = function(Opal) {')
28
- expect_compiled("", options).to end_with("};\n")
27
+ expect_compiled("true", options).to include('Opal.modules["pippo"] = function(Opal) {')
28
+ expect_compiled("true", options).to end_with("};\n")
29
29
  end
30
30
  end
31
31
 
@@ -89,18 +89,18 @@ RSpec.describe Opal::Compiler do
89
89
 
90
90
  describe "method names" do
91
91
  it "generates a named function for method" do
92
- expect_compiled("def test_method; end").to include("function $$test_method()")
92
+ expect_compiled("def test_method; []; end").to include("function $$test_method()")
93
93
  end
94
94
 
95
95
  context "when function name is reserved" do
96
96
  it "generates a valid named function for method" do
97
- expect_compiled("def Array; end").to include("function $$Array()")
97
+ expect_compiled("def Array; []; end").to include("function $$Array()")
98
98
  end
99
99
  end
100
100
 
101
101
  context "when function name is not valid" do
102
102
  it "generates a name in a safe way" do
103
- expect_compiled("def test_method?; end").to include("function $test_method$ques$1()")
103
+ expect_compiled("def test_method?; []; end").to include("function $test_method$ques$1()")
104
104
  end
105
105
  end
106
106
  end
@@ -6,7 +6,7 @@ RSpec.describe Opal::Rewriters::Base do
6
6
  include RewritersHelper
7
7
 
8
8
  def body_ast_of(method_source)
9
- def_ast = parse_without_rewriting(method_source)
9
+ def_ast = parse_without_rewriting(method_source).children.first
10
10
  _, _, body_ast = *def_ast
11
11
  body_ast
12
12
  end