opal 1.7.4 → 1.8.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.eslintrc.js +1 -0
- data/.github/workflows/build.yml +9 -9
- data/.rubocop/todo.yml +2 -2
- data/.rubocop.yml +17 -10
- data/.rubocop_todo.yml +311 -0
- data/CHANGELOG.md +1 -15
- data/README.md +7 -7
- data/UNRELEASED.md +92 -1
- data/benchmark-ips/bm_block_vs_yield.rb +3 -0
- data/benchmark-ips/bm_slice_or_not.rb +53 -0
- data/docs/bridging.md +112 -0
- data/docs/compiled_ruby.md +10 -10
- data/docs/getting_started.md +18 -22
- data/docs/releasing.md +8 -16
- data/lib/opal/cli_runners/chrome_cdp_interface.rb +1 -0
- data/lib/opal/cli_runners/firefox_cdp_interface.rb +1 -0
- data/lib/opal/compiler.rb +33 -1
- data/lib/opal/nodes/args/extract_kwoptarg.rb +2 -1
- data/lib/opal/nodes/call.rb +1 -1
- data/lib/opal/nodes/call_special.rb +71 -47
- data/lib/opal/nodes/closure.rb +15 -7
- data/lib/opal/nodes/defined.rb +1 -1
- data/lib/opal/nodes/hash.rb +14 -30
- data/lib/opal/nodes/if.rb +37 -29
- data/lib/opal/nodes/literal.rb +15 -7
- data/lib/opal/nodes/rescue.rb +1 -1
- data/lib/opal/nodes/x_string.rb +13 -0
- data/lib/opal/parser/patch.rb +1 -0
- data/lib/opal/rewriters/for_rewriter.rb +36 -24
- data/lib/opal/source_map/file.rb +1 -1
- data/lib/opal/version.rb +1 -1
- data/opal/corelib/array/pack.rb +1 -0
- data/opal/corelib/array.rb +110 -64
- data/opal/corelib/basic_object.rb +1 -0
- data/opal/corelib/binding.rb +2 -0
- data/opal/corelib/boolean.rb +1 -0
- data/opal/corelib/class.rb +28 -8
- data/opal/corelib/comparable.rb +1 -0
- data/opal/corelib/complex.rb +3 -1
- data/opal/corelib/constants.rb +2 -2
- data/opal/corelib/dir.rb +2 -0
- data/opal/corelib/enumerable.rb +3 -2
- data/opal/corelib/enumerator/arithmetic_sequence.rb +3 -1
- data/opal/corelib/enumerator/chain.rb +1 -0
- data/opal/corelib/enumerator/generator.rb +1 -0
- data/opal/corelib/enumerator/lazy.rb +1 -0
- data/opal/corelib/enumerator/yielder.rb +2 -0
- data/opal/corelib/enumerator.rb +1 -0
- data/opal/corelib/error/errno.rb +2 -0
- data/opal/corelib/error.rb +22 -0
- data/opal/corelib/file.rb +1 -0
- data/opal/corelib/hash.rb +224 -519
- data/opal/corelib/helpers.rb +1 -0
- data/opal/corelib/io.rb +2 -0
- data/opal/corelib/irb.rb +2 -0
- data/opal/corelib/kernel/format.rb +1 -0
- data/opal/corelib/kernel.rb +70 -15
- data/opal/corelib/main.rb +2 -0
- data/opal/corelib/marshal/read_buffer.rb +2 -0
- data/opal/corelib/marshal/write_buffer.rb +2 -0
- data/opal/corelib/math/polyfills.rb +2 -0
- data/opal/corelib/math.rb +1 -0
- data/opal/corelib/method.rb +2 -0
- data/opal/corelib/module.rb +45 -5
- data/opal/corelib/nil.rb +3 -1
- data/opal/corelib/number.rb +30 -1
- data/opal/corelib/numeric.rb +2 -0
- data/opal/corelib/object_space.rb +1 -0
- data/opal/corelib/pack_unpack/format_string_parser.rb +2 -0
- data/opal/corelib/proc.rb +30 -28
- data/opal/corelib/process.rb +2 -0
- data/opal/corelib/random/formatter.rb +2 -0
- data/opal/corelib/random/math_random.js.rb +2 -0
- data/opal/corelib/random/mersenne_twister.rb +2 -0
- data/opal/corelib/random/seedrandom.js.rb +2 -0
- data/opal/corelib/random.rb +1 -0
- data/opal/corelib/range.rb +35 -13
- data/opal/corelib/rational.rb +3 -1
- data/opal/corelib/regexp.rb +1 -0
- data/opal/corelib/runtime.js +297 -259
- data/opal/corelib/set.rb +2 -0
- data/opal/corelib/string/encoding.rb +3 -0
- data/opal/corelib/string/unpack.rb +2 -0
- data/opal/corelib/string.rb +56 -20
- data/opal/corelib/struct.rb +4 -2
- data/opal/corelib/time.rb +2 -1
- data/opal/corelib/trace_point.rb +2 -0
- data/opal/corelib/unsupported.rb +2 -0
- data/opal/corelib/variables.rb +2 -0
- data/opal.gemspec +2 -2
- data/spec/filters/bugs/array.rb +58 -2
- data/spec/filters/bugs/basicobject.rb +7 -0
- data/spec/filters/bugs/bigdecimal.rb +1 -2
- data/spec/filters/bugs/binding.rb +1 -0
- data/spec/filters/bugs/class.rb +2 -3
- data/spec/filters/bugs/complex.rb +3 -0
- data/spec/filters/bugs/date.rb +5 -2
- data/spec/filters/bugs/datetime.rb +1 -0
- data/spec/filters/bugs/delegate.rb +1 -2
- data/spec/filters/bugs/encoding.rb +1 -1
- data/spec/filters/bugs/enumerable.rb +11 -3
- data/spec/filters/bugs/enumerator.rb +15 -2
- data/spec/filters/bugs/exception.rb +9 -4
- data/spec/filters/bugs/file.rb +2 -0
- data/spec/filters/bugs/float.rb +1 -0
- data/spec/filters/bugs/freeze.rb +5 -49
- data/spec/filters/bugs/hash.rb +1 -13
- data/spec/filters/bugs/integer.rb +5 -6
- data/spec/filters/bugs/kernel.rb +12 -43
- data/spec/filters/bugs/language.rb +33 -15
- data/spec/filters/bugs/marshal.rb +63 -4
- data/spec/filters/bugs/method.rb +2 -10
- data/spec/filters/bugs/module.rb +18 -7
- data/spec/filters/bugs/objectspace.rb +2 -0
- data/spec/filters/bugs/pathname.rb +1 -0
- data/spec/filters/bugs/proc.rb +4 -2
- data/spec/filters/bugs/random.rb +0 -3
- data/spec/filters/bugs/range.rb +1 -2
- data/spec/filters/bugs/rational.rb +2 -0
- data/spec/filters/bugs/refinement.rb +19 -0
- data/spec/filters/bugs/regexp.rb +27 -5
- data/spec/filters/bugs/ruby-32.rb +0 -6
- data/spec/filters/bugs/set.rb +10 -2
- data/spec/filters/bugs/singleton.rb +0 -2
- data/spec/filters/bugs/string.rb +140 -2
- data/spec/filters/bugs/struct.rb +16 -10
- data/spec/filters/bugs/time.rb +56 -2
- data/spec/filters/bugs/trace_point.rb +1 -0
- data/spec/filters/bugs/unboundmethod.rb +4 -9
- data/spec/filters/bugs/warnings.rb +0 -1
- data/spec/filters/platform/firefox/exception.rb +3 -3
- data/spec/filters/platform/firefox/kernel.rb +1 -0
- data/spec/filters/platform/safari/exception.rb +2 -2
- data/spec/filters/platform/safari/float.rb +1 -0
- data/spec/filters/platform/safari/kernel.rb +1 -0
- data/spec/filters/platform/safari/literal_regexp.rb +2 -2
- data/spec/filters/unsupported/hash.rb +1 -0
- data/spec/lib/compiler_spec.rb +28 -17
- data/spec/mspec-opal/formatters.rb +2 -0
- data/spec/mspec-opal/runner.rb +2 -0
- data/spec/opal/core/array/dup_spec.rb +2 -0
- data/spec/opal/core/class/clone_spec.rb +36 -0
- data/spec/opal/core/exception_spec.rb +2 -0
- data/spec/opal/core/hash/internals_spec.rb +154 -206
- data/spec/opal/core/hash_spec.rb +2 -0
- data/spec/opal/core/iterable_props_spec.rb +2 -0
- data/spec/opal/core/kernel/at_exit_spec.rb +2 -0
- data/spec/opal/core/kernel/respond_to_spec.rb +2 -0
- data/spec/opal/core/language/arguments/mlhs_arg_spec.rb +2 -0
- data/spec/opal/core/language/safe_navigator_spec.rb +2 -0
- data/spec/opal/core/language/xstring_send_spec.rb +15 -0
- data/spec/opal/core/language/xstring_spec.rb +2 -0
- data/spec/opal/core/language_spec.rb +2 -0
- data/spec/opal/core/module_spec.rb +44 -0
- data/spec/opal/core/number/to_i_spec.rb +2 -0
- data/spec/opal/core/object_id_spec.rb +2 -6
- data/spec/opal/core/regexp/match_spec.rb +2 -0
- data/spec/opal/core/runtime/bridged_classes_spec.rb +38 -0
- data/spec/opal/core/runtime/constants_spec.rb +2 -0
- data/spec/opal/core/runtime/eval_spec.rb +2 -0
- data/spec/opal/core/runtime/exit_spec.rb +2 -0
- data/spec/opal/core/runtime/is_a_spec.rb +2 -0
- data/spec/opal/core/runtime/loaded_spec.rb +2 -0
- data/spec/opal/core/runtime/method_missing_spec.rb +2 -0
- data/spec/opal/core/runtime/rescue_spec.rb +2 -0
- data/spec/opal/core/runtime/string_spec.rb +2 -0
- data/spec/opal/core/runtime/truthy_spec.rb +2 -0
- data/spec/opal/core/runtime_spec.rb +2 -6
- data/spec/opal/core/string/to_sym_spec.rb +2 -0
- data/spec/opal/language/predefined_spec.rb +20 -0
- data/spec/opal/language/yield_spec.rb +43 -0
- data/spec/opal/stdlib/js_spec.rb +2 -0
- data/spec/opal/stdlib/native/alias_native_spec.rb +2 -0
- data/spec/opal/stdlib/native/array_spec.rb +2 -0
- data/spec/opal/stdlib/native/date_spec.rb +2 -0
- data/spec/opal/stdlib/native/each_spec.rb +2 -0
- data/spec/opal/stdlib/native/element_reference_spec.rb +2 -0
- data/spec/opal/stdlib/native/exposure_spec.rb +2 -0
- data/spec/opal/stdlib/native/ext_spec.rb +2 -0
- data/spec/opal/stdlib/native/hash_spec.rb +30 -2
- data/spec/opal/stdlib/native/initialize_spec.rb +2 -0
- data/spec/opal/stdlib/native/method_missing_spec.rb +2 -0
- data/spec/opal/stdlib/native/native_alias_spec.rb +2 -0
- data/spec/opal/stdlib/native/native_class_spec.rb +2 -0
- data/spec/opal/stdlib/native/native_module_spec.rb +2 -0
- data/spec/opal/stdlib/native/native_reader_spec.rb +2 -0
- data/spec/opal/stdlib/native/native_writer_spec.rb +2 -0
- data/spec/opal/stdlib/native/new_spec.rb +2 -0
- data/spec/opal/stdlib/native/struct_spec.rb +2 -0
- data/spec/ruby_specs +0 -2
- data/spec/spec_helper.rb +2 -0
- data/stdlib/await.rb +1 -0
- data/stdlib/base64.rb +2 -0
- data/stdlib/bigdecimal/bignumber.js.rb +2 -0
- data/stdlib/bigdecimal/util.rb +1 -0
- data/stdlib/bigdecimal.rb +4 -0
- data/stdlib/buffer/array.rb +2 -0
- data/stdlib/buffer/view.rb +2 -0
- data/stdlib/buffer.rb +2 -0
- data/stdlib/cgi.rb +14 -0
- data/stdlib/console.rb +2 -0
- data/stdlib/date/date_time.rb +2 -0
- data/stdlib/date.rb +2 -0
- data/stdlib/delegate.rb +5 -4
- data/stdlib/deno/base.rb +2 -0
- data/stdlib/deno/file.rb +2 -0
- data/stdlib/erb.rb +2 -0
- data/stdlib/gjs/io.rb +2 -0
- data/stdlib/gjs/kernel.rb +2 -0
- data/stdlib/headless_browser/base.rb +2 -0
- data/stdlib/headless_browser/file.rb +1 -0
- data/stdlib/headless_browser.rb +1 -0
- data/stdlib/js.rb +2 -0
- data/stdlib/json.rb +9 -15
- data/stdlib/logger.rb +2 -0
- data/stdlib/nashorn/file.rb +2 -0
- data/stdlib/nashorn/io.rb +2 -0
- data/stdlib/native.rb +48 -48
- data/stdlib/nodejs/base.rb +2 -0
- data/stdlib/nodejs/dir.rb +2 -0
- data/stdlib/nodejs/env.rb +2 -0
- data/stdlib/nodejs/file.rb +2 -0
- data/stdlib/nodejs/fileutils.rb +2 -0
- data/stdlib/nodejs/io.rb +2 -0
- data/stdlib/nodejs/js-yaml-3-6-1.js +1 -1
- data/stdlib/nodejs/kernel.rb +2 -0
- data/stdlib/nodejs/open-uri.rb +2 -0
- data/stdlib/nodejs/pathname.rb +2 -0
- data/stdlib/nodejs/require.rb +2 -0
- data/stdlib/nodejs/yaml.rb +9 -3
- data/stdlib/opal/miniracer.rb +2 -0
- data/stdlib/opal-parser.rb +8 -1
- data/stdlib/opal-platform.rb +2 -0
- data/stdlib/opal-replutils.rb +2 -0
- data/stdlib/open-uri.rb +4 -1
- data/stdlib/ostruct.rb +4 -2
- data/stdlib/pathname.rb +3 -1
- data/stdlib/pp.rb +1 -0
- data/stdlib/promise/v2.rb +24 -7
- data/stdlib/quickjs/io.rb +2 -0
- data/stdlib/quickjs/kernel.rb +2 -0
- data/stdlib/quickjs.rb +2 -0
- data/stdlib/securerandom.rb +2 -0
- data/stdlib/stringio.rb +2 -0
- data/stdlib/strscan.rb +2 -0
- data/stdlib/time.rb +2 -0
- data/stdlib/uri.rb +1 -0
- data/tasks/performance/optimization_status.rb +2 -0
- data/tasks/testing.rake +16 -11
- data/test/nodejs/test_await.rb +1 -0
- data/test/nodejs/test_dir.rb +2 -0
- data/test/nodejs/test_error.rb +2 -0
- data/test/nodejs/test_file.rb +2 -0
- data/test/nodejs/test_string.rb +2 -0
- data/test/nodejs/test_yaml.rb +20 -0
- data/test/opal/promisev2/test_always.rb +14 -0
- data/test/opal/unsupported_and_bugs.rb +0 -8
- metadata +26 -13
- data/spec/filters/bugs/openstruct.rb +0 -8
data/spec/filters/bugs/time.rb
CHANGED
@@ -10,6 +10,13 @@ opal_filter "Time" do
|
|
10
10
|
fails "Time#ceil copies own timezone to the returning value" # NoMethodError: undefined method `ceil' for 2010-03-30 05:43:25 UTC
|
11
11
|
fails "Time#ceil defaults to ceiling to 0 places" # NoMethodError: undefined method `ceil' for 2010-03-30 05:43:25 UTC
|
12
12
|
fails "Time#ceil returns an instance of Time, even if #ceil is called on a subclass" # Expected Time to be identical to #<Class:0xa40e6>
|
13
|
+
fails "Time#deconstruct_keys ignores non-Symbol keys" # NoMethodError: undefined method `deconstruct_keys' for 2022-10-05 13:30:00 +0200
|
14
|
+
fails "Time#deconstruct_keys ignores not existing Symbol keys" # NoMethodError: undefined method `deconstruct_keys' for 2022-10-05 13:30:00 +0200
|
15
|
+
fails "Time#deconstruct_keys it raises error when argument is neither nil nor array" # Expected TypeError (wrong argument type Integer (expected Array or nil)) but got: NoMethodError (undefined method `deconstruct_keys' for 2022-10-05 13:30:00 +0200)
|
16
|
+
fails "Time#deconstruct_keys requires one argument" # Expected ArgumentError but got: NoMethodError (undefined method `deconstruct_keys' for 2022-10-05 13:30:00 +0200)
|
17
|
+
fails "Time#deconstruct_keys returns only specified keys" # NoMethodError: undefined method `deconstruct_keys' for 2022-10-05 13:39:00 UTC
|
18
|
+
fails "Time#deconstruct_keys returns whole hash for nil as an argument" # NoMethodError: undefined method `deconstruct_keys' for 2022-10-05 13:30:00 UTC
|
19
|
+
fails "Time#deconstruct_keys returns {} when passed []" # NoMethodError: undefined method `deconstruct_keys' for 2022-10-05 13:30:00 +0200
|
13
20
|
fails "Time#dup returns a clone of Time instance" # NoMethodError: undefined method `now' for #<Module:0x133b8>
|
14
21
|
fails "Time#floor copies own timezone to the returning value" # NoMethodError: undefined method `floor' for 2010-03-30 05:43:25 UTC
|
15
22
|
fails "Time#floor defaults to flooring to 0 places" # NoMethodError: undefined method `floor' for 2010-03-30 05:43:25 UTC
|
@@ -24,19 +31,22 @@ opal_filter "Time" do
|
|
24
31
|
fails "Time#getlocal 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" # NoMethodError: undefined method `getlocal' for 2000-01-01 12:00:00 UTC
|
25
32
|
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
33
|
fails "Time#gmtime converts self to UTC, modifying the receiver" # Expected 2007-01-09 05:00:00 UTC == 2007-01-09 12:00:00 UTC to be truthy but was false
|
27
|
-
fails "Time#hash returns an Integer" # Expected "Time:100000" (String) to be an instance of Integer
|
28
34
|
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
|
29
35
|
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
|
30
36
|
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
|
31
37
|
fails "Time#inspect uses the correct time zone with microseconds" # NoMethodError: undefined method `localtime' for 2000-01-01 00:00:00 UTC
|
32
38
|
fails "Time#inspect uses the correct time zone without microseconds" # NoMethodError: undefined method `localtime' for 2000-01-01 00:00:00 UTC
|
39
|
+
fails "Time#localtime on a frozen time raises a FrozenError if the time has a different time zone" # Expected FrozenError but got: NoMethodError (undefined method `localtime' for 2007-01-09 12:00:00 UTC)
|
33
40
|
fails "Time#localtime raises ArgumentError if the String argument is not in an ASCII-compatible encoding" # Expected ArgumentError but got: NoMethodError (undefined method `localtime' for 2022-12-07 05:21:43 +0100)
|
41
|
+
fails "Time#localtime returns a Time with a UTC offset specified as A-Z military zone" # NoMethodError: undefined method `localtime' for 2007-01-09 12:00:00 +0100
|
42
|
+
fails "Time#localtime returns a Time with a UTC offset specified as UTC" # NoMethodError: undefined method `localtime' for 2007-01-09 12:00:00 +0100
|
34
43
|
fails "Time#nsec returns a positive value for dates before the epoch" # NoMethodError: undefined method `nsec' for 1969-11-12 13:18:57 UTC
|
35
44
|
fails "Time#round copies own timezone to the returning value" # NoMethodError: undefined method `round' for 2010-03-30 05:43:25 UTC
|
36
45
|
fails "Time#round defaults to rounding to 0 places" # NoMethodError: undefined method `round' for 2010-03-30 05:43:25 UTC
|
37
46
|
fails "Time#round returns an instance of Time, even if #round is called on a subclass" # Expected Time to be identical to #<Class:0x5990a>
|
38
47
|
fails "Time#round rounds to 0 decimal places with an explicit argument" # NoMethodError: undefined method `round' for 2010-03-30 05:43:25 UTC
|
39
48
|
fails "Time#round rounds to 7 decimal places with an explicit argument" # NoMethodError: undefined method `round' for 2010-03-30 05:43:25 UTC
|
49
|
+
fails "Time#strftime applies '-' flag to UTC time" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: Z
|
40
50
|
fails "Time#strftime rounds an offset to the nearest second when formatting with %z" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
|
41
51
|
fails "Time#strftime should be able to print the commercial year with leading zeroes" # Expected "200" == "0200" to be truthy but was false
|
42
52
|
fails "Time#strftime should be able to print the commercial year with only two digits" # TypeError: no implicit conversion of Range into Integer
|
@@ -51,6 +61,7 @@ opal_filter "Time" do
|
|
51
61
|
fails "Time#strftime with %N formats the nanoseconds of the second with %9N" # Expected "000000000" == "001234000" to be truthy but was false
|
52
62
|
fails "Time#strftime with %N formats the nanoseconds of the second with %N" # Expected "000000000" == "001234560" to be truthy but was false
|
53
63
|
fails "Time#strftime with %N formats the picoseconds of the second with %12N" # Expected "000000000000" == "999999999999" to be truthy but was false
|
64
|
+
fails "Time#strftime works correctly with width, _ and 0 flags, and :" # Expected "-0000" == " -000" to be truthy but was false
|
54
65
|
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
|
55
66
|
fails "Time#to_date yields accurate julian date for Julian-Gregorian gap value" # Expected 2299170 == 2299160 to be truthy but was false
|
56
67
|
fails "Time#to_date yields accurate julian date for ambiguous pre-Gregorian reform value" # Expected 2299160 == 2299150 to be truthy but was false
|
@@ -62,9 +73,17 @@ opal_filter "Time" do
|
|
62
73
|
fails "Time#tv_sec rounds fractional seconds toward zero" # Expected -315619200 == -315619199 to be truthy but was false
|
63
74
|
fails "Time#usec returns a positive value for dates before the epoch" # Expected 0 == 404240 to be truthy but was false
|
64
75
|
fails "Time#utc converts self to UTC, modifying the receiver" # Expected 2007-01-09 05:00:00 UTC == 2007-01-09 12:00:00 UTC to be truthy but was false
|
76
|
+
fails "Time#utc? does not treat time with +00:00 offset as UTC" # Expected true == false to be truthy but was false
|
77
|
+
fails "Time#utc? does not treat time with 0 offset as UTC" # Expected true == false to be truthy but was false
|
78
|
+
fails "Time#utc? does treat time with 'UTC' offset as UTC" # NoMethodError: undefined method `localtime' for 2023-09-20 22:52:11 +0200
|
79
|
+
fails "Time#utc? does treat time with -00:00 offset as UTC" # NoMethodError: undefined method `localtime' for 2023-09-20 22:52:11 +0200
|
80
|
+
fails "Time#utc? does treat time with Z offset as UTC" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: Z
|
65
81
|
fails "Time#zone Encoding.default_internal is set returns an ASCII string" # NoMethodError: undefined method `default_internal' for Encoding
|
66
82
|
fails "Time#zone defaults to UTC when bad zones given" # Expected 3600 == 0 to be truthy but was false
|
83
|
+
fails "Time#zone returns UTC when called on a UTC time" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: Z
|
84
|
+
fails "Time.at :in keyword argument could be UTC offset as a 'UTC' String" # TypeError: no implicit conversion of Hash into Integer
|
67
85
|
fails "Time.at :in keyword argument could be UTC offset as a String in '+HH:MM or '-HH:MM' format" # TypeError: no implicit conversion of Hash into Integer
|
86
|
+
fails "Time.at :in keyword argument could be UTC offset as a military zone A-Z" # TypeError: no implicit conversion of Hash into Integer
|
68
87
|
fails "Time.at :in keyword argument could be UTC offset as a number of seconds" # TypeError: no implicit conversion of Hash into Integer
|
69
88
|
fails "Time.at :in keyword argument could be a timezone object" # TypeError: no implicit conversion of Hash into Integer
|
70
89
|
fails "Time.at :in keyword argument raises ArgumentError if format is invalid" # Expected ArgumentError but got: TypeError (no implicit conversion of Hash into Integer)
|
@@ -81,21 +100,45 @@ opal_filter "Time" do
|
|
81
100
|
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
|
82
101
|
fails "Time.gm handles fractional usec close to rounding limit" # NoMethodError: undefined method `nsec' for 2000-01-01 12:30:00 UTC
|
83
102
|
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)
|
103
|
+
fails "Time.gm raises an ArgumentError for out of range month" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (month out of range: 16)
|
104
|
+
fails "Time.gm raises an ArgumentError for out of range second" # Expected ArgumentError (argument out of range) but got: ArgumentError (sec out of range: -1)
|
84
105
|
fails "Time.httpdate parses RFC-2616 strings" # NoMethodError: undefined method `httpdate' for Time
|
85
106
|
fails "Time.local raises an ArgumentError for out of range microsecond" # Expected ArgumentError but no exception was raised (2000-01-01 20:15:01 +0100 was returned)
|
107
|
+
fails "Time.local raises an ArgumentError for out of range month" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (month out of range: 16)
|
108
|
+
fails "Time.local raises an ArgumentError for out of range second" # Expected ArgumentError (argument out of range) but got: ArgumentError (sec out of range: -1)
|
86
109
|
fails "Time.local uses the 'CET' timezone with TZ=Europe/Amsterdam in 1970" # Expected [0, 0, 0, 16, 5, 1970, 6, 136, false, "Central European Standard Time"] == [0, 0, 0, 16, 5, 1970, 6, 136, false, "CET"] to be truthy but was false
|
87
110
|
fails "Time.mktime raises an ArgumentError for out of range microsecond" # Expected ArgumentError but no exception was raised (2000-01-01 20:15:01 +0100 was returned)
|
111
|
+
fails "Time.mktime raises an ArgumentError for out of range month" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (month out of range: 16)
|
112
|
+
fails "Time.mktime raises an ArgumentError for out of range second" # Expected ArgumentError (argument out of range) but got: ArgumentError (sec out of range: -1)
|
88
113
|
fails "Time.mktime uses the 'CET' timezone with TZ=Europe/Amsterdam in 1970" # Expected [0, 0, 0, 16, 5, 1970, 6, 136, false, "Central European Standard Time"] == [0, 0, 0, 16, 5, 1970, 6, 136, false, "CET"] to be truthy but was false
|
89
114
|
fails "Time.new has at least microsecond precision" # NoMethodError: undefined method `nsec' for 2022-12-07 05:20:59 +0100
|
115
|
+
fails "Time.new raises an ArgumentError for out of range month" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (month out of range: 16)
|
116
|
+
fails "Time.new raises an ArgumentError for out of range second" # Expected ArgumentError (argument out of range) but got: ArgumentError (sec out of range: -1)
|
90
117
|
fails "Time.new uses the 'CET' timezone with TZ=Europe/Amsterdam in 1970" # Expected [0, 0, 0, 16, 5, 1970, 6, 136, false, "Central European Standard Time"] == [0, 0, 0, 16, 5, 1970, 6, 136, false, "CET"] to be truthy but was false
|
91
118
|
fails "Time.new uses the local timezone" # Expected 3600 == -28800 to be truthy but was false
|
92
119
|
fails "Time.new with a timezone argument #name method cannot marshal Time if #name method isn't implemented" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
|
93
120
|
fails "Time.new with a timezone argument #name method uses the optional #name method for marshaling" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
|
121
|
+
fails "Time.new with a timezone argument :in keyword argument allows omitting minor arguments" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
|
122
|
+
fails "Time.new with a timezone argument :in keyword argument converts to a provided timezone if all the positional arguments are omitted" # TypeError: no implicit conversion of Hash into Integer
|
94
123
|
fails "Time.new with a timezone argument :in keyword argument could be UTC offset as a String in '+HH:MM or '-HH:MM' format" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
|
95
124
|
fails "Time.new with a timezone argument :in keyword argument could be UTC offset as a number of seconds" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
|
96
125
|
fails "Time.new with a timezone argument :in keyword argument could be a timezone object" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
|
126
|
+
fails "Time.new with a timezone argument :in keyword argument raises ArgumentError if two offset arguments are given" # Expected ArgumentError (timezone argument given as positional and keyword arguments) but got: ArgumentError ([Time.new] wrong number of arguments (given 8, expected -1))
|
127
|
+
fails "Time.new with a timezone argument :in keyword argument returns a Time with UTC offset specified as a single letter military timezone" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
|
97
128
|
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 doesn't support other types for a timezone argument than Integer and String
|
98
129
|
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 doesn't support other types for a timezone argument than Integer and String
|
130
|
+
fails "Time.new with a timezone argument Time.new with a String argument accepts precision keyword argument and truncates specified digits of sub-second part" # NoMethodError: undefined method `subsec' for 2021-01-01 00:00:00 +0100
|
131
|
+
fails "Time.new with a timezone argument Time.new with a String argument converts precision keyword argument into Integer if is not nil" # TypeError: no implicit conversion of Hash into Integer
|
132
|
+
fails "Time.new with a timezone argument Time.new with a String argument parses an ISO-8601 like format" # Expected 2020-01-01 00:00:00 +0100 == 2020-12-24 15:56:17 UTC to be truthy but was false
|
133
|
+
fails "Time.new with a timezone argument Time.new with a String argument raise TypeError is can't convert precision keyword argument into Integer" # Expected TypeError (no implicit conversion from string) but got: TypeError (no implicit conversion of Hash into Integer)
|
134
|
+
fails "Time.new with a timezone argument Time.new with a String argument raises ArgumentError if String argument is not in the supported format" # Expected ArgumentError (year must be 4 or more digits: 021) but no exception was raised (21-01-01 00:00:00 +0124 was returned)
|
135
|
+
fails "Time.new with a timezone argument Time.new with a String argument raises ArgumentError if date/time parts values are not valid" # Expected ArgumentError (mon out of range) but no exception was raised (2020-01-01 00:00:00 +0100 was returned)
|
136
|
+
fails "Time.new with a timezone argument Time.new with a String argument raises ArgumentError if part of time string is missing" # Expected ArgumentError (missing sec part: 00:56 ) but no exception was raised (2020-01-01 00:00:00 +0100 was returned)
|
137
|
+
fails "Time.new with a timezone argument Time.new with a String argument raises ArgumentError if string has not ascii-compatible encoding" # Expected ArgumentError (time string should have ASCII compatible encoding) but no exception was raised (2021-01-01 00:00:00 +0100 was returned)
|
138
|
+
fails "Time.new with a timezone argument Time.new with a String argument raises ArgumentError if subsecond is missing after dot" # Expected ArgumentError (subsecond expected after dot: 00:56:17. ) but no exception was raised (2020-01-01 00:00:00 +0100 was returned)
|
139
|
+
fails "Time.new with a timezone argument Time.new with a String argument returns Time in timezone specified in the String argument even if the in keyword argument provided" # TypeError: no implicit conversion of Hash into Integer
|
140
|
+
fails "Time.new with a timezone argument Time.new with a String argument returns Time in timezone specified in the String argument" # Expected "2021-01-01 00:00:00 +0100" == "2021-12-25 00:00:00 +0500" to be truthy but was false
|
141
|
+
fails "Time.new with a timezone argument Time.new with a String argument returns Time in timezone specified with in keyword argument if timezone isn't provided in the String argument" # TypeError: no implicit conversion of Hash into Integer
|
99
142
|
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)
|
100
143
|
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)
|
101
144
|
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 doesn't support other types for a timezone argument than Integer and String)
|
@@ -110,12 +153,20 @@ opal_filter "Time" do
|
|
110
153
|
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 doesn't support other types for a timezone argument than Integer and String)
|
111
154
|
fails "Time.new with a timezone argument the #abbr method is used by '%Z' in #strftime" # ArgumentError: Opal doesn't support other types for a timezone argument than Integer and String
|
112
155
|
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 (2000-01-01 00:00:00 -0410.000000000000028 was returned)
|
113
|
-
fails "Time.new with a utc_offset argument raises ArgumentError if the
|
156
|
+
fails "Time.new with a utc_offset argument raises ArgumentError if the string argument is J" # Expected ArgumentError ("+HH:MM", "-HH:MM", "UTC" or "A".."I","K".."Z" expected for utc_offset: J) but got: ArgumentError ("+HH:MM", "-HH:MM", "UTC" expected for utc_offset: J)
|
114
157
|
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 (2000-01-01 00:00:00 +27777746.66666666418314 was returned)
|
158
|
+
fails "Time.new with a utc_offset argument returns a Time with UTC offset specified as a single letter military timezone" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: A
|
159
|
+
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as +HH" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: +05
|
115
160
|
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as +HH:MM:SS" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: +05:30:37
|
161
|
+
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as +HHMM" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: +0530
|
162
|
+
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as +HHMMSS" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: +053037
|
163
|
+
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as -HH" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: -05
|
164
|
+
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as -HHMM" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: -0530
|
165
|
+
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as -HHMMSS" # ArgumentError: "+HH:MM", "-HH:MM", "UTC" expected for utc_offset: -053037
|
116
166
|
fails "Time.now :in keyword argument could be UTC offset as a String in '+HH:MM or '-HH:MM' format" # ArgumentError: [Time.now] wrong number of arguments (given 1, expected 0)
|
117
167
|
fails "Time.now :in keyword argument could be UTC offset as a number of seconds" # ArgumentError: [Time.now] wrong number of arguments (given 1, expected 0)
|
118
168
|
fails "Time.now :in keyword argument could be a timezone object" # ArgumentError: [Time.now] wrong number of arguments (given 1, expected 0)
|
169
|
+
fails "Time.now :in keyword argument returns a Time with UTC offset specified as a single letter military timezone" # ArgumentError: [Time.now] wrong number of arguments (given 1, expected 0)
|
119
170
|
fails "Time.now has at least microsecond precision" # NoMethodError: undefined method `nsec' for 2022-12-07 05:21:38 +0100
|
120
171
|
fails "Time.now uses the local timezone" # Expected 3600 == -28800 to be truthy but was false
|
121
172
|
fails "Time.rfc2822 parses RFC-2822 strings" # NoMethodError: undefined method `rfc2822' for Time
|
@@ -124,9 +175,12 @@ opal_filter "Time" do
|
|
124
175
|
fails "Time.rfc822 parses RFC-822 strings" # NoMethodError: undefined method `rfc2822' for Time
|
125
176
|
fails "Time.utc handles fractional usec close to rounding limit" # NoMethodError: undefined method `nsec' for 2000-01-01 12:30:00 UTC
|
126
177
|
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)
|
178
|
+
fails "Time.utc raises an ArgumentError for out of range month" # Expected ArgumentError (/(mon|argument) out of range/) but got: ArgumentError (month out of range: 16)
|
179
|
+
fails "Time.utc raises an ArgumentError for out of range second" # Expected ArgumentError (argument out of range) but got: ArgumentError (sec out of range: -1)
|
127
180
|
fails "Time.xmlschema parses ISO-8601 strings" # NoMethodError: undefined method `xmlschema' for Time
|
128
181
|
fails_badly "Time#dst? dst? returns whether time is during daylight saving time" # Expected false == true to be truthy but was false
|
129
182
|
fails_badly "Time#isdst dst? returns whether time is during daylight saving time" # Expected false == true to be truthy but was false
|
130
183
|
fails_badly "Time#strftime with %z formats a local time with positive UTC offset as '+HHMM'" # Expected "+0900" == "+0100" to be truthy but was false
|
131
184
|
fails_badly "Time#yday returns an integer representing the day of the year, 1..366" # Expected 117 == 116 to be truthy but was false
|
185
|
+
fails_badly "Time.new with a timezone argument Time.new with a String argument returns Time in local timezone if not provided in the String argument" # Expected "Fiji Summer Time" == "Fiji Standard Time" to be truthy but was false
|
132
186
|
end
|
@@ -8,5 +8,6 @@ opal_filter "TracePoint" do
|
|
8
8
|
fails "TracePoint#inspect returns a String showing the event, path and line for a :class event" # Expected "#<TracePoint:0x89c86 @event=\"class\" @block=#<Proc:0x89c88> @trace_object=TracePointSpec::C @trace_evt=\"trace_class\" @tracers_for_evt=\"tracers_for_class\">" == "#<TracePoint:class ruby/core/tracepoint/inspect_spec.rb:87>" to be truthy but was false
|
9
9
|
fails "TracePoint#inspect returns a String showing the event, path and line" # RuntimeError: Only the :class event is supported
|
10
10
|
fails "TracePoint#inspect returns a string containing a human-readable TracePoint status" # RuntimeError: Only the :class event is supported
|
11
|
+
fails "TracePoint#inspect shows only whether it's enabled when outside the TracePoint handler" # RuntimeError: Only the :class event is supported
|
11
12
|
fails "TracePoint#self return the trace object from event" # RuntimeError: Only the :class event is supported
|
12
13
|
end
|
@@ -3,9 +3,12 @@ opal_filter "UnboundMethod" do
|
|
3
3
|
fails "UnboundMethod#== considers methods through aliasing and visibility change equal" # Expected #<Method: Class#new (defined in Class in <internal:corelib/class.rb>:40)> == #<Method: Class#n (defined in #<Class:> in <internal:corelib/class.rb>:40)> to be truthy but was false
|
4
4
|
fails "UnboundMethod#== considers methods through aliasing equal" # Expected #<Method: Class#new (defined in Class in <internal:corelib/class.rb>:40)> == #<Method: Class#n (defined in #<Class:> in <internal:corelib/class.rb>:40)> to be truthy but was false
|
5
5
|
fails "UnboundMethod#== considers methods through visibility change equal" # Expected #<Method: Class#new (defined in Class in <internal:corelib/class.rb>:40)> == #<Method: Class#new (defined in Class in <internal:corelib/class.rb>:40)> to be truthy but was false
|
6
|
+
fails "UnboundMethod#== returns false if same method but extracted from two different subclasses" # Expected false == true to be truthy but was false
|
6
7
|
fails "UnboundMethod#== returns true if both are aliases for a third method" # Expected false == true to be truthy but was false
|
7
8
|
fails "UnboundMethod#== returns true if either is an alias for the other" # Expected false == true to be truthy but was false
|
9
|
+
fails "UnboundMethod#== returns true if methods are the same but added from an included Module" # Expected false == true to be truthy but was false
|
8
10
|
fails "UnboundMethod#== returns true if objects refer to the same method" # Expected false == true to be truthy but was false
|
11
|
+
fails "UnboundMethod#== returns true if same method but one extracted from a subclass" # Expected false == true to be truthy but was false
|
9
12
|
fails "UnboundMethod#== returns true if same method is extracted from the same subclass" # Expected false == true to be truthy but was false
|
10
13
|
fails "UnboundMethod#arity for a Method generated by respond_to_missing? returns -1" # Mock 'method arity respond_to_missing' expected to receive respond_to_missing?("any_args") exactly 1 times but received it 0 times
|
11
14
|
fails "UnboundMethod#bind the returned Method is equal to the one directly returned by obj.method" # Expected #<Method: UnboundMethodSpecs::Methods#foo (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:30)> == #<Method: UnboundMethodSpecs::Methods#foo (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:30)> to be truthy but was false
|
@@ -17,16 +20,8 @@ opal_filter "UnboundMethod" do
|
|
17
20
|
fails "UnboundMethod#original_name returns the name of the method" # NoMethodError: undefined method `original_name' for #<UnboundMethod: String#upcase (defined in String in <internal:corelib/string.rb>:1685)>
|
18
21
|
fails "UnboundMethod#original_name returns the original name even when aliased twice" # NoMethodError: undefined method `original_name' for #<UnboundMethod: UnboundMethodSpecs::Methods#foo (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:30)>
|
19
22
|
fails "UnboundMethod#original_name returns the original name" # NoMethodError: undefined method `original_name' for #<UnboundMethod: UnboundMethodSpecs::Methods#foo (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:30)>
|
20
|
-
fails "UnboundMethod#private? returns false when the method is protected" # NoMethodError: undefined method `private?' for #<UnboundMethod: UnboundMethodSpecs::Methods#my_protected_method (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:58)>
|
21
|
-
fails "UnboundMethod#private? returns false when the method is public" # NoMethodError: undefined method `private?' for #<UnboundMethod: UnboundMethodSpecs::Methods#my_public_method (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:57)>
|
22
|
-
fails "UnboundMethod#private? returns true when the method is private" # NoMethodError: undefined method `private?' for #<UnboundMethod: UnboundMethodSpecs::Methods#my_private_method (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:59)>
|
23
|
-
fails "UnboundMethod#protected? returns false when the method is private" # NoMethodError: undefined method `protected?' for #<UnboundMethod: UnboundMethodSpecs::Methods#my_private_method (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:59)>
|
24
|
-
fails "UnboundMethod#protected? returns false when the method is public" # NoMethodError: undefined method `protected?' for #<UnboundMethod: UnboundMethodSpecs::Methods#my_public_method (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:57)>
|
25
|
-
fails "UnboundMethod#protected? returns true when the method is protected" # NoMethodError: undefined method `protected?' for #<UnboundMethod: UnboundMethodSpecs::Methods#my_protected_method (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:58)>
|
26
|
-
fails "UnboundMethod#public? returns false when the method is private" # NoMethodError: undefined method `public?' for #<UnboundMethod: UnboundMethodSpecs::Methods#my_private_method (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:59)>
|
27
|
-
fails "UnboundMethod#public? returns false when the method is protected" # NoMethodError: undefined method `public?' for #<UnboundMethod: UnboundMethodSpecs::Methods#my_protected_method (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:58)>
|
28
|
-
fails "UnboundMethod#public? returns true when the method is public" # NoMethodError: undefined method `public?' for #<UnboundMethod: UnboundMethodSpecs::Methods#my_public_method (defined in UnboundMethodSpecs::Methods in ruby/core/unboundmethod/fixtures/classes.rb:57)>
|
29
23
|
fails "UnboundMethod#source_location sets the first value to the path of the file in which the method was defined" # Expected "ruby/core/unboundmethod/fixtures/classes.rb" == "./ruby/core/unboundmethod/fixtures/classes.rb" to be truthy but was false
|
24
|
+
fails "UnboundMethod#source_location works for eval with a given line" # Expected ["(eval)", 0] == ["foo", 100] to be truthy but was false
|
30
25
|
fails "UnboundMethod#super_method after aliasing an inherited method returns the expected super_method" # NoMethodError: undefined method `super_method' for #<UnboundMethod: MethodSpecs::InheritedMethods::C#meow (defined in MethodSpecs::InheritedMethods::C in ruby/core/method/fixtures/classes.rb:233)>
|
31
26
|
fails "UnboundMethod#super_method after changing an inherited methods visibility returns the expected super_method" # NoMethodError: undefined method `super_method' for #<UnboundMethod: MethodSpecs::InheritedMethods::C#derp (defined in MethodSpecs::InheritedMethods::B in ruby/core/method/fixtures/classes.rb:233)>
|
32
27
|
fails "UnboundMethod#super_method returns nil when the parent's method is removed" # NoMethodError: undefined method `super_method' for #<UnboundMethod: #<Class:0x4b228>#foo (defined in #<Class:0x4b228> in ruby/core/unboundmethod/super_method_spec.rb:21)>
|
@@ -3,7 +3,6 @@ opal_filter "warnings" do
|
|
3
3
|
fails "Array#join when $, is not nil warns" # Expected warning to match: /warning: \$, is set to non-nil value/ but got: ""
|
4
4
|
fails "Constant resolution within methods with dynamically assigned constants returns the updated value when a constant is reassigned" # Expected warning to match: /already initialized constant/ but got: ""
|
5
5
|
fails "Hash#fetch gives precedence to the default block over the default argument when passed both" # Expected warning to match: /block supersedes default value argument/ but got: ""
|
6
|
-
fails "Kernel#=~ is deprecated" # Expected warning to match: /deprecated Object#=~ is called on Object/ but got: ""
|
7
6
|
fails "Literal (A::X) constant resolution with dynamically assigned constants returns the updated value when a constant is reassigned" # Expected warning to match: /already initialized constant/ but got: ""
|
8
7
|
fails "Literal Regexps matches against $_ (last input) in a conditional if no explicit matchee provided" # Expected warning to match: /regex literal in condition/ but got: ""
|
9
8
|
fails "Module#const_get with dynamically assigned constants returns the updated value of a constant" # Expected warning to match: /already initialized constant/ but got: ""
|
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# NOTE: run bin/format-filters after changing this file
|
2
2
|
opal_unsupported_filter "Exception" do
|
3
|
-
fails "Exception#backtrace_locations sets each element to a Thread::Backtrace::Location"
|
4
3
|
fails "Exception#backtrace contains lines of the same format for each prior position in the stack"
|
5
4
|
fails "Exception#backtrace sets each element to a String"
|
6
|
-
fails "
|
5
|
+
fails "Exception#backtrace_locations sets each element to a Thread::Backtrace::Location"
|
7
6
|
fails "Invoking a method when the method is not available should omit the method_missing call from the backtrace for NameError"
|
7
|
+
fails "Invoking a method when the method is not available should omit the method_missing call from the backtrace for NoMethodError"
|
8
8
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
#
|
1
|
+
# NOTE: run bin/format-filters after changing this file
|
2
2
|
opal_unsupported_filter "Exception" do
|
3
3
|
fails "Exception#backtrace contains lines of the same format for each prior position in the stack"
|
4
|
-
fails "Exception#backtrace_locations sets each element to a Thread::Backtrace::Location"
|
5
4
|
fails "Exception#backtrace returns an Array that can be updated"
|
6
5
|
fails "Exception#backtrace returns the same array after duping"
|
7
6
|
fails "Exception#backtrace sets each element to a String"
|
7
|
+
fails "Exception#backtrace_locations sets each element to a Thread::Backtrace::Location"
|
8
8
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# NOTE: run bin/format-filters after changing this file
|
1
2
|
opal_filter "Float" do
|
2
3
|
fails "Float#fdiv performs floating-point division between self and an Integer" # Expected 8.900000000008007e-117 == 8.900000000008011e-117 to be truthy but was false
|
3
4
|
fails "Float#quo performs floating-point division between self and an Integer" # Expected 8.900000000008007e-117 == 8.900000000008011e-117 to be truthy but was false
|
@@ -1,6 +1,6 @@
|
|
1
|
+
# NOTE: run bin/format-filters after changing this file
|
1
2
|
opal_unsupported_filter "Literal Regexp" do
|
2
|
-
# Safari and WebKit do not support lookbehind, but may in the future see https://github.com/WebKit/WebKit/pull/7109
|
3
3
|
fails "Literal Regexps handles a lookbehind with ss characters"
|
4
|
-
fails "Literal Regexps supports (?<= ) (positive lookbehind)"
|
5
4
|
fails "Literal Regexps supports (?<! ) (negative lookbehind)"
|
5
|
+
fails "Literal Regexps supports (?<= ) (positive lookbehind)"
|
6
6
|
end
|
@@ -1,5 +1,6 @@
|
|
1
1
|
# NOTE: run bin/format-filters after changing this file
|
2
2
|
opal_unsupported_filter "Hash" do
|
3
|
+
fails "Hash#[] compares key via hash" # Mock '0' expected to receive hash("any_args") exactly 1 times but received it 0 times (performance optimization)
|
3
4
|
fails "Hash#[]= duplicates and freezes string keys" # NotImplementedError: String#<< not supported. Mutable String methods are not supported in Opal.
|
4
5
|
fails "Hash#[]= duplicates string keys using dup semantics" # TypeError: can't define singleton
|
5
6
|
fails "Hash#assoc only returns the first matching key-value pair for identity hashes" # Expected 1 == 2 to be truthy but was false
|
data/spec/lib/compiler_spec.rb
CHANGED
@@ -154,13 +154,6 @@ RSpec.describe Opal::Compiler do
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
-
describe "escapes in x-strings" do
|
158
|
-
it "compiles the exscapes directly as appearing in x-strings" do
|
159
|
-
expect_compiled('`"hello\nworld"`').to include('"hello\nworld"')
|
160
|
-
expect_compiled('%x{"hello\nworld"}').to include('"hello\nworld"')
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
157
|
describe 'pre-processing require-ish methods' do
|
165
158
|
describe '#require' do
|
166
159
|
it 'parses and resolve #require argument' do
|
@@ -221,6 +214,10 @@ RSpec.describe Opal::Compiler do
|
|
221
214
|
expect_compiled("foo = 42 if Test > 4").to include("if ($truthy($rb_gt($$('Test'), 4))) ")
|
222
215
|
end
|
223
216
|
|
217
|
+
it 'adds nil check for self' do
|
218
|
+
expect_compiled("foo = 42 if self > 4").to include("if ($truthy($rb_gt(self, 4))) ")
|
219
|
+
end
|
220
|
+
|
224
221
|
it 'converts each == call inside if to an $eqeq wrapper, which does a truthy check' do
|
225
222
|
expect_compiled('foo = 42 if 2 == 3').to include("if ($eqeq(2, 3))")
|
226
223
|
expect_compiled('foo = 42 if 2.5 == 3.5').to include("if ($eqeq(2.5, 3.5))")
|
@@ -324,6 +321,15 @@ RSpec.describe Opal::Compiler do
|
|
324
321
|
end
|
325
322
|
|
326
323
|
describe 'x-strings' do
|
324
|
+
let(:compiler_options) { {backtick_javascript: true} }
|
325
|
+
|
326
|
+
describe "escapes" do
|
327
|
+
it "compiles the exscapes directly as appearing in x-strings" do
|
328
|
+
expect_compiled('`"hello\nworld"`').to include('"hello\nworld"')
|
329
|
+
expect_compiled('%x{"hello\nworld"}').to include('"hello\nworld"')
|
330
|
+
end
|
331
|
+
end
|
332
|
+
|
327
333
|
describe 'semicolons handling' do
|
328
334
|
def compiling(code, &block)
|
329
335
|
compiler = Opal::Compiler.new(code)
|
@@ -477,9 +483,10 @@ RSpec.describe Opal::Compiler do
|
|
477
483
|
}).to include("return nil\n")
|
478
484
|
end
|
479
485
|
|
480
|
-
def expect_number_of_warnings(code)
|
486
|
+
def expect_number_of_warnings(code, options = compiler_options)
|
487
|
+
options = options.merge(eval: true)
|
481
488
|
warnings_number = 0
|
482
|
-
compiler = Opal::Compiler.new(code,
|
489
|
+
compiler = Opal::Compiler.new(code, options)
|
483
490
|
allow(compiler).to receive(:warning) { warnings_number += 1}
|
484
491
|
compiler.compile
|
485
492
|
expect(warnings_number)
|
@@ -695,21 +702,25 @@ RSpec.describe Opal::Compiler do
|
|
695
702
|
end
|
696
703
|
end
|
697
704
|
|
698
|
-
def
|
699
|
-
|
705
|
+
def compiler_options
|
706
|
+
{}
|
707
|
+
end
|
708
|
+
|
709
|
+
def compiled(code, options = compiler_options)
|
710
|
+
Opal::Compiler.new(code, options).compile
|
700
711
|
end
|
701
712
|
|
702
|
-
def parsed(
|
703
|
-
Opal::Compiler.new(
|
713
|
+
def parsed(code, options = compiler_options)
|
714
|
+
Opal::Compiler.new(code, options).parse
|
704
715
|
end
|
705
716
|
|
706
717
|
alias compile compiled
|
707
718
|
|
708
|
-
def expect_compiled(
|
709
|
-
expect(compiled(
|
719
|
+
def expect_compiled(code, options = compiler_options)
|
720
|
+
expect(compiled(code, options))
|
710
721
|
end
|
711
722
|
|
712
|
-
def compiler_for(
|
713
|
-
Opal::Compiler.new(
|
723
|
+
def compiler_for(code, options = compiler_options)
|
724
|
+
Opal::Compiler.new(code, options).tap(&:compile)
|
714
725
|
end
|
715
726
|
end
|
data/spec/mspec-opal/runner.rb
CHANGED
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe "Class#clone" do
|
4
|
+
it "should copy an instance method including super call" do
|
5
|
+
parent = Class.new do
|
6
|
+
def hello
|
7
|
+
"hello"
|
8
|
+
end
|
9
|
+
end
|
10
|
+
child = Class.new(parent) do
|
11
|
+
def hello
|
12
|
+
super + " world"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
child.clone.new.hello.should == "hello world"
|
17
|
+
end
|
18
|
+
|
19
|
+
it "retains an included module in the ancestor chain" do
|
20
|
+
klass = Class.new
|
21
|
+
mod = Module.new do
|
22
|
+
def hello
|
23
|
+
"hello"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
klass.include(mod)
|
28
|
+
klass.clone.new.hello.should == "hello"
|
29
|
+
end
|
30
|
+
|
31
|
+
it "copies a method with a block argument defined by define_method" do
|
32
|
+
klass = Class.new
|
33
|
+
klass.define_method(:add_one) { |&block| block.call + 1 }
|
34
|
+
klass.clone.new.add_one { 1 }.should == 2
|
35
|
+
end
|
36
|
+
end
|