opal 0.8.1 → 0.9.0.beta1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -2
- data/.gitmodules +3 -3
- data/.jshintrc +17 -20
- data/.travis.yml +22 -11
- data/CHANGELOG.md +51 -1
- data/CODE_OF_CONDUCT.md +15 -0
- data/CONTRIBUTING.md +125 -9
- data/Gemfile +1 -1
- data/Guardfile +2 -2
- data/README.md +95 -29
- data/Rakefile +1 -1
- data/benchmark/benchmarks +103 -0
- data/benchmark/bm_array_flatten.rb +9 -0
- data/benchmark/bm_array_intersection_numbers.rb +7 -0
- data/benchmark/bm_array_intersection_objects.rb +7 -0
- data/benchmark/bm_array_intersection_strings.rb +7 -0
- data/benchmark/bm_array_join_ary.rb +9 -0
- data/benchmark/bm_array_minus_numbers.rb +7 -0
- data/benchmark/bm_array_minus_objects.rb +7 -0
- data/benchmark/bm_array_minus_strings.rb +7 -0
- data/benchmark/bm_array_union_numbers.rb +7 -0
- data/benchmark/bm_array_union_objects.rb +7 -0
- data/benchmark/bm_array_union_strings.rb +7 -0
- data/benchmark/bm_array_uniq_bang_numbers.rb +5 -0
- data/benchmark/bm_array_uniq_bang_objects.rb +5 -0
- data/benchmark/bm_array_uniq_bang_strings.rb +5 -0
- data/benchmark/bm_array_uniq_numbers.rb +5 -0
- data/benchmark/bm_array_uniq_objects.rb +5 -0
- data/benchmark/bm_array_uniq_strings.rb +5 -0
- data/benchmark/bm_dispatch_bind_table.rb +57 -0
- data/benchmark/bm_dispatch_code_gen.rb +65 -0
- data/benchmark/bm_dispatch_code_gen_if.rb +64 -0
- data/benchmark/bm_dispatch_hardcoded.rb +44 -0
- data/benchmark/bm_dispatch_send.rb +38 -0
- data/benchmark/bm_dispatch_send_table.rb +57 -0
- data/benchmark/bm_hash_assoc_object.rb +11 -0
- data/benchmark/bm_hash_assoc_string.rb +9 -0
- data/benchmark/bm_hash_clone_object.rb +9 -0
- data/benchmark/bm_hash_clone_string.rb +9 -0
- data/benchmark/bm_hash_delete_object.rb +11 -0
- data/benchmark/bm_hash_delete_string.rb +9 -0
- data/benchmark/bm_hash_each_key_object.rb +9 -0
- data/benchmark/bm_hash_each_key_string.rb +9 -0
- data/benchmark/bm_hash_each_object.rb +9 -0
- data/benchmark/bm_hash_each_string.rb +9 -0
- data/benchmark/bm_hash_each_value_object.rb +9 -0
- data/benchmark/bm_hash_each_value_string.rb +9 -0
- data/benchmark/bm_hash_element_reference_object.rb +11 -0
- data/benchmark/bm_hash_element_reference_string.rb +9 -0
- data/benchmark/bm_hash_element_set_object.rb +5 -0
- data/benchmark/bm_hash_element_set_string.rb +5 -0
- data/benchmark/bm_hash_equal_value_object.rb +14 -0
- data/benchmark/bm_hash_equal_value_string.rb +11 -0
- data/benchmark/bm_hash_fetch_object.rb +11 -0
- data/benchmark/bm_hash_fetch_string.rb +9 -0
- data/benchmark/bm_hash_flatten_object.rb +9 -0
- data/benchmark/bm_hash_flatten_string.rb +9 -0
- data/benchmark/bm_hash_has_key_object.rb +11 -0
- data/benchmark/bm_hash_has_key_string.rb +9 -0
- data/benchmark/bm_hash_has_value_object.rb +9 -0
- data/benchmark/bm_hash_has_value_string.rb +9 -0
- data/benchmark/bm_hash_hash_object.rb +9 -0
- data/benchmark/bm_hash_hash_string.rb +9 -0
- data/benchmark/bm_hash_inspect_object.rb +9 -0
- data/benchmark/bm_hash_inspect_string.rb +9 -0
- data/benchmark/bm_hash_invert_object.rb +9 -0
- data/benchmark/bm_hash_invert_string.rb +9 -0
- data/benchmark/bm_hash_keep_if_object.rb +9 -0
- data/benchmark/bm_hash_keep_if_string.rb +9 -0
- data/benchmark/bm_hash_key_object.rb +9 -0
- data/benchmark/bm_hash_key_string.rb +9 -0
- data/benchmark/bm_hash_keys_object.rb +9 -0
- data/benchmark/bm_hash_keys_string.rb +9 -0
- data/benchmark/bm_hash_literal_mixed_large.rb +3 -0
- data/benchmark/bm_hash_literal_mixed_small.rb +3 -0
- data/benchmark/bm_hash_literal_object_large.rb +4 -0
- data/benchmark/bm_hash_literal_object_small.rb +3 -0
- data/benchmark/bm_hash_literal_string_large.rb +4 -0
- data/benchmark/bm_hash_literal_string_small.rb +3 -0
- data/benchmark/bm_hash_merge_object.rb +22 -0
- data/benchmark/bm_hash_merge_string.rb +18 -0
- data/benchmark/bm_hash_rassoc_object.rb +9 -0
- data/benchmark/bm_hash_rassoc_string.rb +9 -0
- data/benchmark/bm_hash_rehash_object.rb +9 -0
- data/benchmark/bm_hash_rehash_string.rb +9 -0
- data/benchmark/bm_hash_reject_bang_object.rb +9 -0
- data/benchmark/bm_hash_reject_bang_string.rb +9 -0
- data/benchmark/bm_hash_reject_object.rb +9 -0
- data/benchmark/bm_hash_reject_string.rb +9 -0
- data/benchmark/bm_hash_replace_object.rb +18 -0
- data/benchmark/bm_hash_replace_string.rb +14 -0
- data/benchmark/bm_hash_select_bang_object.rb +9 -0
- data/benchmark/bm_hash_select_bang_string.rb +9 -0
- data/benchmark/bm_hash_select_object.rb +9 -0
- data/benchmark/bm_hash_select_string.rb +9 -0
- data/benchmark/bm_hash_shift_object.rb +10 -0
- data/benchmark/bm_hash_shift_string.rb +10 -0
- data/benchmark/bm_hash_to_a_object.rb +9 -0
- data/benchmark/bm_hash_to_a_string.rb +9 -0
- data/benchmark/bm_hash_to_h_object.rb +10 -0
- data/benchmark/bm_hash_to_h_string.rb +10 -0
- data/benchmark/bm_hash_values_object.rb +9 -0
- data/benchmark/bm_hash_values_string.rb +9 -0
- data/benchmark/run.rb +48 -0
- data/bin/opal-mspec +1 -1
- data/bin/opal-repl +4 -4
- data/docs/compiled_ruby.md +214 -56
- data/docs/configuring_gems.md +2 -2
- data/docs/faq.md +2 -2
- data/docs/getting_started.md +19 -2
- data/docs/jquery.md +5 -5
- data/docs/opal_parser.md +53 -0
- data/docs/unsupported_features.md +2 -2
- data/docs/upgrading.md +22 -0
- data/docs/using_sprockets.md +15 -0
- data/examples/rack/config.ru +13 -0
- data/examples/sinatra/config.ru +4 -5
- data/lib/mspec/opal/runner.rb +54 -11
- data/lib/opal.rb +1 -1
- data/lib/opal/builder.rb +1 -1
- data/lib/opal/builder_processors.rb +1 -1
- data/lib/opal/cli.rb +17 -13
- data/lib/opal/cli_options.rb +1 -1
- data/lib/opal/compiler.rb +12 -0
- data/lib/opal/config.rb +4 -0
- data/lib/opal/nodes/arglist.rb +5 -7
- data/lib/opal/nodes/call.rb +6 -1
- data/lib/opal/nodes/call_special.rb +74 -0
- data/lib/opal/nodes/def.rb +35 -28
- data/lib/opal/nodes/definitions.rb +3 -5
- data/lib/opal/nodes/for.rb +13 -0
- data/lib/opal/nodes/helpers.rb +15 -1
- data/lib/opal/nodes/if.rb +5 -5
- data/lib/opal/nodes/iter.rb +6 -1
- data/lib/opal/nodes/literal.rb +1 -1
- data/lib/opal/nodes/logic.rb +2 -2
- data/lib/opal/nodes/masgn.rb +1 -2
- data/lib/opal/nodes/module.rb +2 -1
- data/lib/opal/nodes/rescue.rb +10 -1
- data/lib/opal/nodes/scope.rb +8 -2
- data/lib/opal/nodes/singleton_class.rb +1 -1
- data/lib/opal/nodes/top.rb +11 -0
- data/lib/opal/nodes/variables.rb +4 -4
- data/lib/opal/parser.rb +21 -3
- data/lib/opal/parser/grammar.rb +3115 -2961
- data/lib/opal/parser/grammar.y +29 -6
- data/lib/opal/parser/lexer.rb +18 -8
- data/lib/opal/sprockets.rb +85 -0
- data/lib/opal/sprockets/processor.rb +11 -35
- data/lib/opal/sprockets/server.rb +3 -15
- data/lib/opal/version.rb +2 -2
- data/opal.gemspec +4 -4
- data/opal/README.md +9 -0
- data/opal/corelib/array.rb +433 -181
- data/opal/corelib/basic_object.rb +48 -4
- data/opal/corelib/boolean.rb +15 -6
- data/opal/corelib/class.rb +6 -5
- data/opal/corelib/comparable.rb +12 -0
- data/opal/corelib/complex.rb +282 -0
- data/opal/corelib/constants.rb +9 -0
- data/opal/corelib/enumerable.rb +83 -34
- data/opal/corelib/enumerator.rb +3 -1
- data/opal/corelib/error.rb +49 -10
- data/opal/corelib/file.rb +1 -0
- data/opal/corelib/hash.rb +353 -577
- data/opal/corelib/helpers.rb +20 -0
- data/opal/corelib/kernel.rb +114 -59
- data/opal/corelib/math.rb +470 -0
- data/opal/corelib/method.rb +11 -2
- data/opal/corelib/module.rb +96 -96
- data/opal/corelib/{nil_class.rb → nil.rb} +20 -1
- data/opal/corelib/number.rb +751 -0
- data/opal/corelib/numeric.rb +77 -437
- data/opal/corelib/proc.rb +81 -1
- data/opal/corelib/process.rb +27 -0
- data/opal/corelib/rational.rb +358 -0
- data/opal/corelib/regexp.rb +156 -27
- data/opal/corelib/runtime.js +724 -335
- data/opal/corelib/string.rb +93 -104
- data/opal/corelib/string/encoding.rb +177 -0
- data/opal/corelib/string/inheritance.rb +2 -0
- data/opal/corelib/struct.rb +105 -18
- data/opal/corelib/time.rb +267 -146
- data/opal/corelib/unsupported.rb +216 -0
- data/opal/corelib/variables.rb +0 -6
- data/opal/opal.rb +8 -22
- data/opal/opal/base.rb +9 -0
- data/opal/opal/mini.rb +17 -0
- data/spec/README.md +1 -1
- data/spec/filters/bugs/array.rb +38 -136
- data/spec/filters/bugs/{basic_object.rb → basicobject.rb} +14 -15
- data/spec/filters/bugs/class.rb +6 -12
- data/spec/filters/bugs/complex.rb +3 -0
- data/spec/filters/bugs/date.rb +162 -10
- data/spec/filters/bugs/enumerable.rb +31 -58
- data/spec/filters/bugs/enumerator.rb +42 -0
- data/spec/filters/bugs/exception.rb +66 -10
- data/spec/filters/bugs/float.rb +17 -0
- data/spec/filters/bugs/hash.rb +11 -97
- data/spec/filters/bugs/inheritance.rb +5 -0
- data/spec/filters/bugs/integer.rb +28 -0
- data/spec/filters/bugs/kernel.rb +304 -12
- data/spec/filters/bugs/language.rb +133 -399
- data/spec/filters/bugs/language_opal.rb +88 -0
- data/spec/filters/bugs/module.rb +203 -62
- data/spec/filters/bugs/numeric.rb +32 -0
- data/spec/filters/bugs/proc.rb +39 -0
- data/spec/filters/bugs/range.rb +148 -0
- data/spec/filters/bugs/regexp.rb +168 -0
- data/spec/filters/bugs/set.rb +46 -3
- data/spec/filters/bugs/singleton.rb +1 -2
- data/spec/filters/bugs/string.rb +59 -90
- data/spec/filters/bugs/strscan.rb +80 -0
- data/spec/filters/bugs/struct.rb +10 -20
- data/spec/filters/bugs/time.rb +17 -184
- data/spec/filters/bugs/unboundmethod.rb +22 -0
- data/spec/filters/unsupported/array.rb +163 -0
- data/spec/filters/unsupported/basicobject.rb +14 -0
- data/spec/filters/unsupported/bignum.rb +46 -0
- data/spec/filters/unsupported/class.rb +4 -0
- data/spec/filters/unsupported/delegator.rb +5 -0
- data/spec/filters/unsupported/enumerable.rb +11 -0
- data/spec/filters/unsupported/enumerator.rb +8 -9
- data/spec/filters/unsupported/fixnum.rb +14 -0
- data/spec/filters/unsupported/float.rb +41 -7
- data/spec/filters/unsupported/freeze.rb +45 -0
- data/spec/filters/unsupported/hash.rb +50 -0
- data/spec/filters/unsupported/integer.rb +3 -0
- data/spec/filters/unsupported/kernel.rb +31 -0
- data/spec/filters/unsupported/language.rb +17 -0
- data/spec/filters/unsupported/matchdata.rb +30 -0
- data/spec/filters/unsupported/math.rb +3 -0
- data/spec/filters/unsupported/module.rb +5 -3
- data/spec/filters/unsupported/pathname.rb +3 -0
- data/spec/filters/unsupported/privacy.rb +136 -0
- data/spec/filters/unsupported/proc.rb +3 -0
- data/spec/filters/unsupported/regexp.rb +59 -0
- data/spec/filters/unsupported/set.rb +4 -0
- data/spec/filters/unsupported/{marshal.rb → singleton.rb} +4 -2
- data/spec/filters/unsupported/{mutable_strings.rb → string.rb} +456 -336
- data/spec/filters/unsupported/struct.rb +3 -0
- data/spec/filters/unsupported/symbol.rb +5 -0
- data/spec/filters/unsupported/taint.rb +16 -0
- data/spec/filters/unsupported/thread.rb +5 -0
- data/spec/filters/unsupported/time.rb +197 -16
- data/spec/lib/cli_spec.rb +14 -4
- data/spec/lib/compiler_spec.rb +9 -1
- data/spec/lib/parser/call_spec.rb +18 -0
- data/spec/lib/parser/not_spec.rb +2 -8
- data/spec/lib/sprockets_spec.rb +24 -0
- data/spec/opal/core/array/intersection_spec.rb +38 -0
- data/spec/opal/core/array/minus_spec.rb +38 -0
- data/spec/opal/core/array/union_spec.rb +38 -0
- data/spec/opal/core/array/uniq_spec.rb +49 -0
- data/spec/opal/core/exception_spec.rb +7 -0
- data/spec/opal/core/fixtures/require_tree_with_dot/file 1.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_with_dot/file 2.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_with_dot/file 3.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_with_dot/index.rb +3 -0
- data/spec/opal/core/hash/internals_spec.rb +332 -0
- data/spec/opal/core/helpers_spec.rb +14 -0
- data/spec/opal/core/kernel/freeze_spec.rb +1 -1
- data/spec/opal/core/kernel/raise_spec.rb +13 -0
- data/spec/opal/core/kernel/require_tree_spec.rb +9 -0
- data/spec/opal/core/language/class_spec.rb +55 -0
- data/spec/opal/core/language/fixtures/send.rb +1 -0
- data/spec/opal/core/language/keyword_arguments_spec.rb +11 -0
- data/spec/opal/core/language/send_spec.rb +5 -0
- data/spec/opal/core/method/to_proc_spec.rb +28 -0
- data/spec/opal/core/module/name_spec.rb +0 -17
- data/spec/opal/core/runtime/bridged_classes_spec.rb +2 -2
- data/spec/opal/core/runtime/eval_spec.rb +1 -1
- data/spec/opal/core/runtime/method_missing_spec.rb +6 -0
- data/spec/opal/core/runtime_spec.rb +51 -0
- data/spec/opal/stdlib/js_spec.rb +66 -0
- data/spec/opal/stdlib/native/hash_spec.rb +36 -0
- data/spec/rubyspecs +152 -273
- data/spec/spec_helper.rb +10 -11
- data/stdlib/base64.rb +9 -9
- data/stdlib/benchmark.rb +551 -4
- data/stdlib/console.rb +94 -0
- data/stdlib/date.rb +1 -1
- data/stdlib/encoding.rb +1 -170
- data/stdlib/js.rb +56 -0
- data/stdlib/json.rb +9 -14
- data/stdlib/math.rb +1 -370
- data/stdlib/native.rb +133 -63
- data/stdlib/nodejs/file.rb +5 -0
- data/stdlib/nodejs/fileutils.rb +13 -6
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/README.md +1 -1
- data/stdlib/opal-parser.rb +1 -2
- data/stdlib/ostruct.rb +65 -6
- data/stdlib/pp.rb +2 -4
- data/stdlib/rbconfig.rb +1 -3
- data/stdlib/strscan.rb +164 -28
- data/tasks/benchmarking.rake +88 -0
- data/tasks/testing.rake +181 -55
- data/{lib/mspec/opal/special_calls.rb → tasks/testing/mspec_special_calls.rb} +1 -1
- data/{lib/mspec/opal/sprockets.js → tasks/testing/phantomjs1-sprockets.js} +17 -6
- data/test/opal/test_keyword.rb +590 -0
- data/vendored-minitest/minitest.rb +2 -2
- data/vendored-minitest/test/unit.rb +5 -0
- metadata +229 -62
- data/benchmarks/operators.rb +0 -11
- data/benchmarks/prova.js.rb +0 -13
- data/docs/libraries.md +0 -36
- data/lib/mspec/opal/new.html.erb +0 -1
- data/lib/mspec/opal/rake_task.rb +0 -248
- data/opal/corelib/match_data.rb +0 -128
- data/spec/filters/bugs/math.rb +0 -95
- data/spec/filters/bugs/nil.rb +0 -7
- data/spec/filters/bugs/opal.rb +0 -9
- data/spec/filters/bugs/regular_expressions.rb +0 -41
- data/spec/filters/bugs/stringscanner.rb +0 -33
- data/spec/filters/unsupported/encoding.rb +0 -102
- data/spec/filters/unsupported/frozen.rb +0 -92
- data/spec/filters/unsupported/hash_compare_by_identity.rb +0 -16
- data/spec/filters/unsupported/integer_size.rb +0 -59
- data/spec/filters/unsupported/method_added.rb +0 -10
- data/spec/filters/unsupported/private_constants.rb +0 -30
- data/spec/filters/unsupported/private_methods.rb +0 -55
- data/spec/filters/unsupported/random.rb +0 -4
- data/spec/filters/unsupported/rational_numbers.rb +0 -4
- data/spec/filters/unsupported/regular_expressions.rb +0 -137
- data/spec/filters/unsupported/ruby_exe.rb +0 -5
- data/spec/filters/unsupported/symbols.rb +0 -17
- data/spec/filters/unsupported/tainted.rb +0 -180
- data/spec/filters/unsupported/trusted.rb +0 -88
- data/stdlib/process.rb +0 -10
- data/tasks/documenting.rake +0 -37
@@ -0,0 +1,16 @@
|
|
1
|
+
opal_filter "taint" do
|
2
|
+
fails "Range#to_s ignores own tainted status"
|
3
|
+
fails "Range#inspect ignores own tainted status"
|
4
|
+
|
5
|
+
fails "String#% doesn't taint the result for %e when argument is tainted"
|
6
|
+
fails "String#% doesn't taint the result for %E when argument is tainted"
|
7
|
+
fails "String#% doesn't taint the result for %f when argument is tainted"
|
8
|
+
fails "String#% doesn't taint the result for %g when argument is tainted"
|
9
|
+
fails "String#% doesn't taint the result for %G when argument is tainted"
|
10
|
+
fails "String#byteslice with index, length always taints resulting strings when self is tainted"
|
11
|
+
fails "String#byteslice with Range always taints resulting strings when self is tainted"
|
12
|
+
|
13
|
+
fails "StringScanner#pre_match taints the returned String if the input was tainted"
|
14
|
+
fails "StringScanner#post_match taints the returned String if the input was tainted"
|
15
|
+
fails "StringScanner#rest taints the returned String if the input was tainted"
|
16
|
+
end
|
@@ -1,21 +1,202 @@
|
|
1
1
|
opal_filter "Time" do
|
2
|
-
fails "Time
|
3
|
-
fails "Time
|
4
|
-
fails "Time
|
5
|
-
fails "Time
|
6
|
-
fails "Time
|
7
|
-
|
8
|
-
fails "Time
|
9
|
-
fails "Time
|
10
|
-
fails "Time
|
11
|
-
fails "Time
|
12
|
-
fails "Time
|
13
|
-
fails "Time
|
14
|
-
fails "Time
|
15
|
-
fails "Time
|
2
|
+
fails "Time#+ accepts arguments that can be coerced into Rational"
|
3
|
+
fails "Time#+ adds a negative Float"
|
4
|
+
fails "Time#+ increments the time by the specified amount as rational numbers"
|
5
|
+
fails "Time#+ maintains microseconds precision"
|
6
|
+
fails "Time#+ maintains nanoseconds precision"
|
7
|
+
fails "Time#+ maintains precision"
|
8
|
+
fails "Time#+ maintains subseconds precision"
|
9
|
+
fails "Time#+ returns a time with the same fixed offset as self"
|
10
|
+
fails "Time#+ tracks microseconds"
|
11
|
+
fails "Time#+ tracks nanoseconds"
|
12
|
+
fails "Time#- accepts arguments that can be coerced into Rational"
|
13
|
+
fails "Time#- maintains microseconds precision"
|
14
|
+
fails "Time#- maintains nanoseconds precision"
|
15
|
+
fails "Time#- maintains precision"
|
16
|
+
fails "Time#- maintains subseconds precision"
|
17
|
+
fails "Time#- returns a time with nanoseconds precision between two time objects"
|
18
|
+
fails "Time#- returns a time with the same fixed offset as self"
|
19
|
+
fails "Time#- tracks microseconds"
|
20
|
+
fails "Time#- tracks nanoseconds"
|
21
|
+
fails "Time#<=> returns -1 if the first argument is a fraction of a microsecond before the second argument"
|
22
|
+
fails "Time#<=> returns -1 if the first argument is a point in time before the second argument (down to a microsecond)"
|
23
|
+
fails "Time#<=> returns 0 if time is the same as other, including fractional microseconds"
|
24
|
+
fails "Time#<=> returns 1 if the first argument is a fraction of a microsecond after the second argument"
|
25
|
+
fails "Time#<=> returns 1 if the first argument is a point in time after the second argument (down to a microsecond)"
|
26
|
+
fails "Time#day returns the day of the month (1..n) for a local Time"
|
27
|
+
fails "Time#day returns the day of the month for a Time with a fixed offset"
|
28
|
+
fails "Time#dst? dst? returns whether time is during daylight saving time"
|
29
|
+
fails "Time#dup returns a subclass instance"
|
30
|
+
fails "Time#eql? returns false if self and other have differing fractional microseconds"
|
31
|
+
fails "Time#eql? returns false if self and other have differing numbers of microseconds"
|
32
|
+
fails "Time#getgm returns a new time which is the utc representation of time"
|
33
|
+
fails "Time#getlocal raises ArgumentError if the argument represents a value greater than or equal to 86400 seconds"
|
34
|
+
fails "Time#getlocal raises ArgumentError if the argument represents a value less than or equal to -86400 seconds"
|
35
|
+
fails "Time#getlocal raises ArgumentError if the String argument is not of the form (+|-)HH:MM"
|
36
|
+
fails "Time#getlocal returns a new time which is the local representation of time"
|
37
|
+
fails "Time#getlocal returns a new time with the correct utc_offset according to the set timezone"
|
38
|
+
fails "Time#getlocal returns a Time with a UTC offset of the specified number of Rational seconds"
|
39
|
+
fails "Time#getlocal returns a Time with a UTC offset specified as +HH:MM"
|
40
|
+
fails "Time#getlocal returns a Time with a UTC offset specified as -HH:MM"
|
41
|
+
fails "Time#getlocal returns a Time with UTC offset specified as an Integer number of seconds"
|
42
|
+
fails "Time#getlocal with an argument that responds to #to_int coerces using #to_int"
|
43
|
+
fails "Time#getlocal with an argument that responds to #to_r coerces using #to_r"
|
44
|
+
fails "Time#getlocal with an argument that responds to #to_str coerces using #to_str"
|
45
|
+
fails "Time#getutc returns a new time which is the utc representation of time"
|
46
|
+
fails "Time#gmtime returns the utc representation of time"
|
47
|
+
fails "Time#gmtoff given negative offset returns a negative offset"
|
48
|
+
fails "Time#gmtoff given positive offset returns a positive offset"
|
49
|
+
fails "Time#gmtoff returns offset as Rational"
|
50
|
+
fails "Time#gmtoff returns the correct offset for Hawaii around daylight savings time change"
|
51
|
+
fails "Time#gmtoff returns the correct offset for New Zealand around daylight savings time change"
|
52
|
+
fails "Time#gmtoff returns the correct offset for US Eastern time zone around daylight savings time change"
|
53
|
+
fails "Time#gmtoff returns the offset in seconds between the timezone of time and UTC"
|
54
|
+
fails "Time#gmt_offset given negative offset returns a negative offset"
|
55
|
+
fails "Time#gmt_offset given positive offset returns a positive offset"
|
56
|
+
fails "Time#gmt_offset returns offset as Rational"
|
57
|
+
fails "Time#gmt_offset returns the correct offset for Hawaii around daylight savings time change"
|
58
|
+
fails "Time#gmt_offset returns the correct offset for New Zealand around daylight savings time change"
|
59
|
+
fails "Time#gmt_offset returns the correct offset for US Eastern time zone around daylight savings time change"
|
60
|
+
fails "Time#gmt_offset returns the offset in seconds between the timezone of time and UTC"
|
61
|
+
fails "Time#hash returns a Fixnum"
|
62
|
+
fails "Time#hour returns the hour of the day (0..23) for a local Time"
|
63
|
+
fails "Time#hour returns the hour of the day for a Time with a fixed offset"
|
64
|
+
fails "Time#isdst dst? returns whether time is during daylight saving time"
|
65
|
+
fails "Time#localtime changes the timezone according to the set one"
|
66
|
+
fails "Time#localtime converts self to local time, modifying the receiver"
|
67
|
+
fails "Time#localtime converts time to the UTC offset specified as an Integer number of seconds"
|
68
|
+
fails "Time#localtime raises ArgumentError if the argument represents a value greater than or equal to 86400 seconds"
|
69
|
+
fails "Time#localtime raises ArgumentError if the argument represents a value less than or equal to -86400 seconds"
|
70
|
+
fails "Time#localtime raises ArgumentError if the String argument is not of the form (+|-)HH:MM"
|
71
|
+
fails "Time#localtime returns a Time with a UTC offset of the specified number of Rational seconds"
|
72
|
+
fails "Time#localtime returns a Time with a UTC offset specified as +HH:MM"
|
73
|
+
fails "Time#localtime returns a Time with a UTC offset specified as -HH:MM"
|
74
|
+
fails "Time#localtime returns self"
|
75
|
+
fails "Time#localtime with an argument that responds to #to_int coerces using #to_int"
|
76
|
+
fails "Time#localtime with an argument that responds to #to_r coerces using #to_r"
|
77
|
+
fails "Time#localtime with an argument that responds to #to_str coerces using #to_str"
|
78
|
+
fails "Time#mday returns the day of the month (1..n) for a local Time"
|
79
|
+
fails "Time#mday returns the day of the month for a Time with a fixed offset"
|
80
|
+
fails "Time#min returns the minute of the hour (0..59) for a local Time"
|
81
|
+
fails "Time#min returns the minute of the hour for a Time with a fixed offset"
|
82
|
+
fails "Time#mon returns the four digit year for a Time with a fixed offset"
|
83
|
+
fails "Time#mon returns the month of the year for a local Time"
|
84
|
+
fails "Time#month returns the four digit year for a Time with a fixed offset"
|
85
|
+
fails "Time#month returns the month of the year for a local Time"
|
86
|
+
fails "Time#nsec returns 0 for a Time constructed with a whole number of seconds"
|
87
|
+
fails "Time#nsec returns the nanoseconds part of a Time constructed with a Float number of seconds"
|
88
|
+
fails "Time#nsec returns the nanoseconds part of a Time constructed with a Rational number of seconds"
|
89
|
+
fails "Time#nsec returns the nanoseconds part of a Time constructed with an Float number of microseconds"
|
90
|
+
fails "Time#nsec returns the nanoseconds part of a Time constructed with an Integer number of microseconds"
|
91
|
+
fails "Time#nsec returns the nanoseconds part of a Time constructed with an Rational number of microseconds"
|
92
|
+
fails "Time#strftime with %L formats the milliseconds of the second"
|
93
|
+
fails "Time#strftime with %z formats a local time with negative UTC offset as '-HHMM'"
|
94
|
+
fails "Time#strftime with %z formats a local time with positive UTC offset as '+HHMM'"
|
16
95
|
fails "Time#strftime with %z formats a time with fixed negative offset as '-HHMM'"
|
17
96
|
fails "Time#strftime with %z formats a time with fixed offset as '+/-HH:MM' with ':' specifier"
|
18
97
|
fails "Time#strftime with %z formats a time with fixed offset as '+/-HH:MM:SS' with '::' specifier"
|
19
|
-
fails "Time#strftime with %z
|
20
|
-
fails "Time#strftime with %
|
98
|
+
fails "Time#strftime with %z formats a time with fixed positive offset as '+HHMM'"
|
99
|
+
fails "Time#strftime with %z formats a UTC time offset as '+0000'"
|
100
|
+
fails "Time#subsec returns 0 as a Fixnum for a Time with a whole number of seconds"
|
101
|
+
fails "Time#subsec returns the fractional seconds as a Rational for a Time constructed with a Float number of seconds"
|
102
|
+
fails "Time#subsec returns the fractional seconds as a Rational for a Time constructed with a Rational number of seconds"
|
103
|
+
fails "Time#subsec returns the fractional seconds as a Rational for a Time constructed with an Float number of microseconds"
|
104
|
+
fails "Time#subsec returns the fractional seconds as a Rational for a Time constructed with an Integer number of microseconds"
|
105
|
+
fails "Time#subsec returns the fractional seconds as a Rational for a Time constructed with an Rational number of microseconds"
|
106
|
+
fails "Time#to_a returns a 10 element array representing the deconstructed time"
|
107
|
+
fails "Time#to_r returns a Rational even for a whole number of seconds"
|
108
|
+
fails "Time#to_r returns the a Rational representing seconds and subseconds since the epoch"
|
109
|
+
fails "Time#usec returns 0 for a Time constructed with an Rational number of microseconds < 1"
|
110
|
+
fails "Time#usec returns the microseconds for time created by Time#local"
|
111
|
+
fails "Time#usec returns the microseconds part of a Time constructed with a Rational number of seconds"
|
112
|
+
fails "Time#usec returns the microseconds part of a Time constructed with an Float number of microseconds > 1"
|
113
|
+
fails "Time#usec returns the microseconds part of a Time constructed with an Integer number of microseconds"
|
114
|
+
fails "Time#usec returns the microseconds part of a Time constructed with an Rational number of microseconds > 1"
|
115
|
+
fails "Time#utc returns the utc representation of time"
|
116
|
+
fails "Time#utc_offset given negative offset returns a negative offset"
|
117
|
+
fails "Time#utc_offset given positive offset returns a positive offset"
|
118
|
+
fails "Time#utc_offset returns offset as Rational"
|
119
|
+
fails "Time#utc_offset returns the correct offset for Hawaii around daylight savings time change"
|
120
|
+
fails "Time#utc_offset returns the correct offset for New Zealand around daylight savings time change"
|
121
|
+
fails "Time#utc_offset returns the correct offset for US Eastern time zone around daylight savings time change"
|
122
|
+
fails "Time#utc_offset returns the offset in seconds between the timezone of time and UTC"
|
123
|
+
fails "Time#wday returns an integer representing the day of the week, 0..6, with Sunday being 0"
|
124
|
+
fails "Time#year returns the four digit year for a local Time as an Integer"
|
125
|
+
fails "Time#year returns the four digit year for a Time with a fixed offset"
|
126
|
+
fails "Time#zone Encoding.default_internal is set doesn't raise errors for a Time with a fixed offset"
|
127
|
+
fails "Time#zone Encoding.default_internal is set returns the string with the default internal encoding"
|
128
|
+
fails "Time#zone returns nil for a Time with a fixed offset"
|
129
|
+
fails "Time#zone returns nil when getting the local time with a fixed offset"
|
130
|
+
fails "Time#zone returns the correct timezone for a local time"
|
131
|
+
fails "Time#zone returns the time zone used for time"
|
132
|
+
fails "Time#zone returns UTC when called on a UTC time"
|
133
|
+
fails "Time.at passed non-Time, non-Numeric with an argument that responds to #to_r coerces using #to_r"
|
134
|
+
fails "Time.at passed Numeric returns a subclass instance on a Time subclass"
|
135
|
+
fails "Time.at passed Time returns a subclass instance"
|
136
|
+
fails "Time.at passed [Integer, Numeric] returns a Time object representing the given number of seconds and Float microseconds since 1970-01-01 00:00:00 UTC"
|
137
|
+
fails "Time.at with a second argument that responds to #to_r coerces using #to_r"
|
138
|
+
fails "Time.gm handles fractional microseconds as a Float"
|
139
|
+
fails "Time.gm handles fractional microseconds as a Rational"
|
140
|
+
fails "Time.gm handles fractional seconds as a Rational"
|
141
|
+
fails "Time.gm handles microseconds"
|
142
|
+
fails "Time.gm ignores fractional seconds if a passed fractional number of microseconds"
|
143
|
+
fails "Time.gm ignores fractional seconds if a passed whole number of microseconds"
|
144
|
+
fails "Time.gm returns subclass instances"
|
145
|
+
fails "Time.local creates a time based on given C-style gmtime arguments, interpreted in the local time zone"
|
146
|
+
fails "Time.local creates a time based on given values, interpreted in the local time zone"
|
147
|
+
fails "Time.local creates the correct time just after dst change"
|
148
|
+
fails "Time.local creates the correct time just before dst change"
|
149
|
+
fails "Time.local handles fractional microseconds as a Float"
|
150
|
+
fails "Time.local handles fractional microseconds as a Rational"
|
151
|
+
fails "Time.local handles fractional seconds as a Rational"
|
152
|
+
fails "Time.local handles microseconds"
|
153
|
+
fails "Time.local ignores fractional seconds if a passed fractional number of microseconds"
|
154
|
+
fails "Time.local ignores fractional seconds if a passed whole number of microseconds"
|
155
|
+
fails "Time.local respects rare old timezones"
|
156
|
+
fails "Time.local returns subclass instances"
|
157
|
+
fails "Time.local timezone changes correctly adjusts the timezone change to 'CEST' on 'Europe/Amsterdam'"
|
158
|
+
fails "Time.local timezone changes correctly adjusts the timezone change to 'EET' on 'Europe/Istanbul'"
|
159
|
+
fails "Time.mktime creates a time based on given C-style gmtime arguments, interpreted in the local time zone"
|
160
|
+
fails "Time.mktime creates a time based on given values, interpreted in the local time zone"
|
161
|
+
fails "Time.mktime creates the correct time just after dst change"
|
162
|
+
fails "Time.mktime creates the correct time just before dst change"
|
163
|
+
fails "Time.mktime handles fractional microseconds as a Float"
|
164
|
+
fails "Time.mktime handles fractional microseconds as a Rational"
|
165
|
+
fails "Time.mktime handles fractional seconds as a Rational"
|
166
|
+
fails "Time.mktime handles microseconds"
|
167
|
+
fails "Time.mktime ignores fractional seconds if a passed fractional number of microseconds"
|
168
|
+
fails "Time.mktime ignores fractional seconds if a passed whole number of microseconds"
|
169
|
+
fails "Time.mktime respects rare old timezones"
|
170
|
+
fails "Time.mktime returns subclass instances"
|
171
|
+
fails "Time.mktime timezone changes correctly adjusts the timezone change to 'CEST' on 'Europe/Amsterdam'"
|
172
|
+
fails "Time.mktime timezone changes correctly adjusts the timezone change to 'EET' on 'Europe/Istanbul'"
|
173
|
+
fails "Time.new creates a subclass instance if called on a subclass"
|
174
|
+
fails "Time.new creates a time based on given values, interpreted in the local time zone"
|
175
|
+
fails "Time.new handles fractional seconds as a Rational"
|
176
|
+
fails "Time.new respects rare old timezones"
|
177
|
+
fails "Time.new returns subclass instances"
|
178
|
+
fails "Time.new timezone changes correctly adjusts the timezone change to 'CEST' on 'Europe/Amsterdam'"
|
179
|
+
fails "Time.new timezone changes correctly adjusts the timezone change to 'EET' on 'Europe/Istanbul'"
|
180
|
+
fails "Time.new with a utc_offset argument adds one hour if the offset minute value is greater than 59"
|
181
|
+
fails "Time.new with a utc_offset argument raises ArgumentError if the argument represents a value greater than or equal to 86400 seconds"
|
182
|
+
fails "Time.new with a utc_offset argument raises ArgumentError if the argument represents a value less than or equal to -86400 seconds"
|
183
|
+
fails "Time.new with a utc_offset argument raises ArgumentError if the hour value is greater than 23"
|
184
|
+
fails "Time.new with a utc_offset argument raises ArgumentError if the String argument is not of the form (+|-)HH:MM"
|
185
|
+
fails "Time.new with a utc_offset argument returns a local Time if the argument is nil"
|
186
|
+
fails "Time.new with a utc_offset argument returns a non-UTC time"
|
187
|
+
fails "Time.new with a utc_offset argument returns a Time with a UTC offset of the specified number of Integer seconds"
|
188
|
+
fails "Time.new with a utc_offset argument returns a Time with a UTC offset of the specified number of Rational seconds"
|
189
|
+
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as +HH:MM"
|
190
|
+
fails "Time.new with a utc_offset argument returns a Time with a UTC offset specified as -HH:MM"
|
191
|
+
fails "Time.new with a utc_offset argument with an argument that responds to #to_int coerces using #to_int"
|
192
|
+
fails "Time.new with a utc_offset argument with an argument that responds to #to_r coerces using #to_r"
|
193
|
+
fails "Time.new with a utc_offset argument with an argument that responds to #to_str coerces using #to_str"
|
194
|
+
fails "Time.now creates a subclass instance if called on a subclass"
|
195
|
+
fails "Time.utc handles fractional microseconds as a Float"
|
196
|
+
fails "Time.utc handles fractional microseconds as a Rational"
|
197
|
+
fails "Time.utc handles fractional seconds as a Rational"
|
198
|
+
fails "Time.utc handles microseconds"
|
199
|
+
fails "Time.utc ignores fractional seconds if a passed fractional number of microseconds"
|
200
|
+
fails "Time.utc ignores fractional seconds if a passed whole number of microseconds"
|
201
|
+
fails "Time.utc returns subclass instances"
|
21
202
|
end
|
data/spec/lib/cli_spec.rb
CHANGED
@@ -115,15 +115,14 @@ describe Opal::CLI do
|
|
115
115
|
end
|
116
116
|
|
117
117
|
describe ':compile option' do
|
118
|
-
let(:options) { {:compile => true, :evals => ['puts
|
118
|
+
let(:options) { {:compile => true, :evals => ['puts 2342']} }
|
119
119
|
|
120
120
|
it 'outputs the compiled javascript' do
|
121
|
-
expect_output_of{ subject.run }.to include(".$puts(
|
122
|
-
expect_output_of{ subject.run }.not_to include("
|
121
|
+
expect_output_of{ subject.run }.to include(".$puts(2342)")
|
122
|
+
expect_output_of{ subject.run }.not_to include("2342\n")
|
123
123
|
end
|
124
124
|
end
|
125
125
|
|
126
|
-
|
127
126
|
describe ':load_paths options' do
|
128
127
|
let(:dir) { File.dirname(file) }
|
129
128
|
let(:filename) { File.basename(file) }
|
@@ -133,6 +132,17 @@ describe Opal::CLI do
|
|
133
132
|
end
|
134
133
|
end
|
135
134
|
|
135
|
+
describe ':sexp option' do
|
136
|
+
let(:options) { {evals: ['puts 4'], sexp: true} }
|
137
|
+
it 'prints syntax expressions for the given code' do
|
138
|
+
expect_output_of{ subject.run }.to eq("(:call, nil, :puts, (:arglist, (:int, 4)))\n")
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
|
143
|
+
|
144
|
+
private
|
145
|
+
|
136
146
|
def expect_output_of
|
137
147
|
@output, _result = output_and_result_of { yield }
|
138
148
|
expect(@output)
|
data/spec/lib/compiler_spec.rb
CHANGED
@@ -38,7 +38,15 @@ describe Opal::Compiler do
|
|
38
38
|
expect_compiled("self.inspect").to include("$inspect()")
|
39
39
|
expect_compiled("self.map { |a| a + 10 }").to include("$map")
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
|
+
it "adds method missing stubs" do
|
43
|
+
expect_compiled("self.puts 'hello'").to include("Opal.add_stubs(['$puts'])")
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'adds method missing stubs with operators' do
|
47
|
+
expect_compiled("class Foo; end; Foo.new > 5").to include("Opal.add_stubs(['$>', '$new'])")
|
48
|
+
end
|
49
|
+
|
42
50
|
it "should compile constant lookups" do
|
43
51
|
expect_compiled("Object").to include("Object")
|
44
52
|
expect_compiled("Array").to include("Array")
|
@@ -154,6 +154,24 @@ describe 'Operator calls followed by parens' do
|
|
154
154
|
end
|
155
155
|
end
|
156
156
|
|
157
|
+
describe 'Calls that include a hash' do
|
158
|
+
it 'parses correctly when a hash followed by a block' do
|
159
|
+
parsed('foo(a => 2, &block)').should == [:call, nil, :foo, [:arglist, [:hash, [:call, nil, :a, [:arglist]], [:int, 2]],[:block_pass, [:call, nil, :block, [:arglist]]]]]
|
160
|
+
end
|
161
|
+
|
162
|
+
it 'parses correctly when only a hash is passed' do
|
163
|
+
parsed('foo(a => 2)').should == [:call, nil, :foo, [:arglist, [:hash, [:call, nil, :a, [:arglist]], [:int, 2]]]]
|
164
|
+
end
|
165
|
+
|
166
|
+
it 'parses correctly when ending in hash' do
|
167
|
+
parsed('foo(1, a => 2)').should == [:call, nil, :foo, [:arglist, [:int, 1], [:hash, [:call, nil, :a, [:arglist]], [:int, 2]]]]
|
168
|
+
end
|
169
|
+
|
170
|
+
it 'parses correctly with another parameter and hash followed by a block' do
|
171
|
+
parsed('foo(1, a => 2, &block)').should == [:call, nil, :foo, [:arglist, [:int, 1], [:hash, [:call, nil, :a, [:arglist]], [:int, 2]], [:block_pass, [:call, nil, :block, [:arglist]]]]]
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
157
175
|
describe 'Calls with trailing comma' do
|
158
176
|
it 'parses correctly' do
|
159
177
|
parsed('foo(1,)').should == [:call, nil, :foo, [:arglist, [:int, 1]]]
|
data/spec/lib/parser/not_spec.rb
CHANGED
@@ -14,14 +14,8 @@ describe "The '!' expression" do
|
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
17
|
-
describe "The '!=' expression" do
|
18
|
-
it "rewrites as !(lhs == rhs)" do
|
19
|
-
parsed("1 != 2").should == [:call, [:call, [:int, 1], :==, [:arglist, [:int, 2]]], '!'.to_sym, [:arglist]]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
17
|
describe "The '!~' expression" do
|
24
|
-
it "
|
25
|
-
parsed("1 !~ 2").should == [:
|
18
|
+
it "does not rewrite as !(lhs =~ rhs)" do
|
19
|
+
parsed("1 !~ 2").should == [:call, [:int, 1], :!~, [:arglist, [:int, 2]]]
|
26
20
|
end
|
27
21
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'lib/spec_helper'
|
2
|
+
require 'opal/sprockets'
|
3
|
+
|
4
|
+
describe Opal::Sprockets do
|
5
|
+
let(:env) { Sprockets::Environment.new }
|
6
|
+
before { Opal.paths.each { |path| env.append_path path } }
|
7
|
+
|
8
|
+
describe '.load_asset' do
|
9
|
+
it 'loads the main asset' do
|
10
|
+
code = described_class.load_asset('console', env)
|
11
|
+
expect(code).to include('Opal.load("console");')
|
12
|
+
end
|
13
|
+
|
14
|
+
it 'marks as loaded "opal" plus all non opal assets' do
|
15
|
+
code = described_class.load_asset('corelib/runtime', env)
|
16
|
+
expect(code).to include('Opal.loaded(["opal","corelib/runtime"]);')
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'returns an empty string if the asset is not found' do
|
20
|
+
code = described_class.load_asset('foo', env)
|
21
|
+
expect(code).to eq('')
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
describe "Array#&" do
|
2
|
+
it "relies on Ruby's #hash (not JavaScript's #toString) for identifying array items" do
|
3
|
+
a1 = [ 123, '123']
|
4
|
+
a2 = ['123', 123 ]
|
5
|
+
(a1 & a2).should == a1
|
6
|
+
(a2 & a1).should == a2
|
7
|
+
|
8
|
+
a1 = [ Time.at(1429521600.1), Time.at(1429521600.9) ]
|
9
|
+
a2 = [ Time.at(1429521600.9), Time.at(1429521600.1) ]
|
10
|
+
(a1 & a2).should == a1
|
11
|
+
(a2 & a1).should == a2
|
12
|
+
|
13
|
+
a1 = [ Object.new, Object.new ]
|
14
|
+
a2 = [ Object.new, Object.new ]
|
15
|
+
(a1 & a2).should == []
|
16
|
+
(a2 & a1).should == []
|
17
|
+
|
18
|
+
a1 = [ 1, 2, 3, '1', '2', '3']
|
19
|
+
a2 = ['1', '2', '3', 1, 2, 3 ]
|
20
|
+
(a1 & a2).should == a1
|
21
|
+
(a2 & a1).should == a2
|
22
|
+
|
23
|
+
a1 = [ [1, 2, 3], '1,2,3']
|
24
|
+
a2 = ['1,2,3', [1, 2, 3] ]
|
25
|
+
(a1 & a2).should == a1
|
26
|
+
(a2 & a1).should == a2
|
27
|
+
|
28
|
+
a1 = [ true, 'true']
|
29
|
+
a2 = ['true', true ]
|
30
|
+
(a1 & a2).should == a1
|
31
|
+
(a2 & a1).should == a2
|
32
|
+
|
33
|
+
a1 = [ false, 'false']
|
34
|
+
a2 = ['false', false ]
|
35
|
+
(a1 & a2).should == a1
|
36
|
+
(a2 & a1).should == a2
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
describe "Array#-" do
|
2
|
+
it "relies on Ruby's #hash (not JavaScript's #toString) for identifying array items" do
|
3
|
+
a1 = [ 123 ]
|
4
|
+
a2 = ['123']
|
5
|
+
(a1 - a2).should == a1
|
6
|
+
(a2 - a1).should == a2
|
7
|
+
|
8
|
+
a1 = [ Time.at(1429521600.1) ]
|
9
|
+
a2 = [ Time.at(1429521600.9) ]
|
10
|
+
(a1 - a2).should == a1
|
11
|
+
(a2 - a1).should == a2
|
12
|
+
|
13
|
+
a1 = [ Object.new ]
|
14
|
+
a2 = [ Object.new ]
|
15
|
+
(a1 - a2).should == a1
|
16
|
+
(a2 - a1).should == a2
|
17
|
+
|
18
|
+
a1 = [ 1, 2, 3 ]
|
19
|
+
a2 = ['1', '2', '3']
|
20
|
+
(a1 - a2).should == a1
|
21
|
+
(a2 - a1).should == a2
|
22
|
+
|
23
|
+
a1 = [ 1, 2, 3 ]
|
24
|
+
a2 = ['1,2,3']
|
25
|
+
(a1 - a2).should == a1
|
26
|
+
(a2 - a1).should == a2
|
27
|
+
|
28
|
+
a1 = [ true ]
|
29
|
+
a2 = ['true']
|
30
|
+
(a1 - a2).should == a1
|
31
|
+
(a2 - a1).should == a2
|
32
|
+
|
33
|
+
a1 = [ false ]
|
34
|
+
a2 = ['false']
|
35
|
+
(a1 - a2).should == a1
|
36
|
+
(a2 - a1).should == a2
|
37
|
+
end
|
38
|
+
end
|