opal 1.0.5 → 1.1.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +14 -12
- data/.gitattributes +1 -1
- data/.github/workflows/build.yml +15 -10
- data/.jshintrc +1 -1
- data/.overcommit.yml +35 -0
- data/.rubocop.yml +44 -7
- data/{.rubocop_todo.yml → .rubocop/todo.yml} +4 -5
- data/CHANGELOG.md +87 -2
- data/Gemfile +1 -2
- data/HACKING.md +2 -9
- data/README.md +20 -17
- data/UNRELEASED.md +108 -0
- data/benchmark-ips/bm_array_pop_1.rb +8 -0
- data/benchmark-ips/bm_array_shift.rb +7 -0
- data/benchmark-ips/class_shovel_vs_singleton_class.rb +16 -0
- data/bin/build-browser-source-map-support +5 -0
- data/bin/format-filters +54 -0
- data/bin/remove-filters +39 -0
- data/docs/roda-sprockets.md +86 -0
- data/docs/sinatra.md +5 -12
- data/examples/rack/Gemfile +1 -0
- data/examples/rack/app/application.rb +3 -0
- data/examples/rack/config.ru +5 -4
- data/exe/opal-repl +2 -83
- data/lib/opal/ast/builder.rb +1 -1
- data/lib/opal/builder.rb +2 -10
- data/lib/opal/builder_processors.rb +1 -1
- data/lib/opal/cli_runners.rb +27 -37
- data/lib/opal/cli_runners/applescript.rb +5 -44
- data/lib/opal/cli_runners/chrome.js +7 -35
- data/lib/opal/cli_runners/chrome.rb +75 -17
- data/lib/opal/cli_runners/compiler.rb +17 -0
- data/lib/opal/cli_runners/nashorn.rb +9 -43
- data/lib/opal/cli_runners/nodejs.rb +18 -47
- data/lib/opal/cli_runners/server.rb +18 -6
- data/lib/opal/cli_runners/source-map-support-browser.js +6445 -0
- data/lib/opal/cli_runners/source-map-support.js +639 -0
- data/lib/opal/cli_runners/system_runner.rb +45 -0
- data/lib/opal/compiler.rb +57 -29
- data/lib/opal/config.rb +0 -5
- data/lib/opal/erb.rb +1 -1
- data/lib/opal/magic_comments.rb +34 -0
- data/lib/opal/nodes/args/arity_check.rb +2 -1
- data/lib/opal/nodes/base.rb +1 -1
- data/lib/opal/nodes/call.rb +1 -4
- data/lib/opal/nodes/def.rb +2 -0
- data/lib/opal/nodes/iter.rb +1 -1
- data/lib/opal/nodes/literal.rb +19 -14
- data/lib/opal/nodes/logic.rb +5 -80
- data/lib/opal/nodes/masgn.rb +2 -0
- data/lib/opal/nodes/rescue.rb +1 -1
- data/lib/opal/nodes/super.rb +24 -10
- data/lib/opal/nodes/top.rb +5 -4
- data/lib/opal/parser/with_c_lexer.rb +2 -1
- data/lib/opal/parser/with_ruby_lexer.rb +1 -1
- data/lib/opal/path_reader.rb +2 -2
- data/lib/opal/paths.rb +8 -5
- data/lib/opal/repl.rb +103 -0
- data/lib/opal/rewriter.rb +4 -0
- data/lib/opal/rewriters/for_rewriter.rb +1 -1
- data/lib/opal/rewriters/js_reserved_words.rb +7 -7
- data/lib/opal/rewriters/numblocks.rb +31 -0
- data/lib/opal/rewriters/returnable_logic.rb +33 -0
- data/lib/opal/version.rb +1 -1
- data/opal.gemspec +25 -25
- data/opal/corelib/array.rb +160 -118
- data/opal/corelib/array/pack.rb +5 -3
- data/opal/corelib/basic_object.rb +4 -4
- data/opal/corelib/class.rb +2 -1
- data/opal/corelib/comparable.rb +49 -31
- data/opal/corelib/constants.rb +5 -5
- data/opal/corelib/enumerable.rb +108 -46
- data/opal/corelib/enumerator.rb +27 -12
- data/opal/corelib/file.rb +3 -1
- data/opal/corelib/hash.rb +6 -1
- data/opal/corelib/helpers.rb +8 -28
- data/opal/corelib/io.rb +12 -7
- data/opal/corelib/kernel.rb +45 -14
- data/opal/corelib/kernel/format.rb +3 -1
- data/opal/corelib/math.rb +8 -6
- data/opal/corelib/method.rb +8 -0
- data/opal/corelib/module.rb +17 -2
- data/opal/corelib/number.rb +3 -12
- data/opal/corelib/proc.rb +16 -0
- data/opal/corelib/random/mersenne_twister.rb +147 -0
- data/opal/corelib/range.rb +3 -13
- data/opal/corelib/regexp.rb +10 -6
- data/opal/corelib/runtime.js +208 -81
- data/opal/corelib/string.rb +55 -49
- data/opal/corelib/string/encoding.rb +109 -32
- data/opal/corelib/string/unpack.rb +2 -17
- data/opal/corelib/struct.rb +14 -1
- data/opal/corelib/time.rb +4 -0
- data/opal/opal.rb +1 -1
- data/opal/opal/mini.rb +1 -1
- data/package.json +1 -0
- data/spec/README.md +10 -0
- data/spec/filters/bugs/array.rb +76 -0
- data/spec/filters/bugs/base64.rb +10 -0
- data/spec/filters/bugs/basicobject.rb +12 -0
- data/spec/filters/bugs/bigdecimal.rb +248 -0
- data/spec/filters/bugs/class.rb +12 -0
- data/spec/filters/bugs/complex.rb +7 -0
- data/spec/filters/bugs/date.rb +104 -0
- data/spec/filters/bugs/encoding.rb +259 -0
- data/spec/filters/bugs/enumerable.rb +26 -0
- data/spec/filters/bugs/enumerator.rb +48 -0
- data/spec/filters/bugs/exception.rb +120 -0
- data/spec/filters/bugs/file.rb +48 -0
- data/spec/filters/bugs/float.rb +74 -0
- data/spec/filters/bugs/hash.rb +60 -0
- data/spec/filters/bugs/integer.rb +78 -0
- data/spec/filters/bugs/io.rb +9 -0
- data/spec/filters/bugs/kernel.rb +401 -0
- data/spec/filters/bugs/language.rb +451 -0
- data/spec/filters/bugs/marshal.rb +50 -0
- data/spec/filters/bugs/math.rb +4 -0
- data/spec/filters/bugs/method.rb +79 -0
- data/spec/filters/bugs/module.rb +281 -0
- data/spec/filters/bugs/nilclass.rb +4 -0
- data/spec/filters/bugs/numeric.rb +27 -0
- data/spec/filters/bugs/openstruct.rb +8 -0
- data/spec/filters/bugs/pack_unpack.rb +138 -0
- data/spec/filters/bugs/pathname.rb +9 -0
- data/spec/filters/bugs/proc.rb +80 -0
- data/spec/filters/bugs/random.rb +20 -0
- data/spec/filters/bugs/range.rb +139 -0
- data/spec/filters/bugs/rational.rb +12 -0
- data/spec/filters/bugs/regexp.rb +91 -0
- data/spec/filters/bugs/set.rb +51 -0
- data/spec/filters/bugs/singleton.rb +7 -0
- data/spec/filters/bugs/string.rb +341 -0
- data/spec/filters/bugs/stringscanner.rb +78 -0
- data/spec/filters/bugs/struct.rb +26 -0
- data/spec/filters/bugs/symbol.rb +7 -0
- data/spec/filters/bugs/time.rb +109 -0
- data/spec/filters/bugs/unboundmethod.rb +33 -0
- data/spec/filters/bugs/warnings.rb +30 -0
- data/spec/filters/unsupported/array.rb +168 -0
- data/spec/filters/unsupported/basicobject.rb +15 -0
- data/spec/filters/unsupported/bignum.rb +55 -0
- data/spec/filters/unsupported/class.rb +5 -0
- data/spec/filters/unsupported/delegator.rb +6 -0
- data/spec/filters/unsupported/enumerable.rb +12 -0
- data/spec/filters/unsupported/enumerator.rb +14 -0
- data/spec/filters/unsupported/file.rb +4 -0
- data/spec/filters/unsupported/fixnum.rb +15 -0
- data/spec/filters/unsupported/float.rb +47 -0
- data/spec/filters/unsupported/freeze.rb +259 -0
- data/spec/filters/unsupported/hash.rb +44 -0
- data/spec/filters/unsupported/integer.rb +101 -0
- data/spec/filters/unsupported/kernel.rb +35 -0
- data/spec/filters/unsupported/language.rb +25 -0
- data/spec/filters/unsupported/marshal.rb +44 -0
- data/spec/filters/unsupported/matchdata.rb +63 -0
- data/spec/filters/unsupported/math.rb +4 -0
- data/spec/filters/unsupported/pathname.rb +4 -0
- data/spec/filters/unsupported/privacy.rb +287 -0
- data/spec/filters/unsupported/proc.rb +4 -0
- data/spec/filters/unsupported/random.rb +5 -0
- data/spec/filters/unsupported/range.rb +8 -0
- data/spec/filters/unsupported/regexp.rb +70 -0
- data/spec/filters/unsupported/set.rb +5 -0
- data/spec/filters/unsupported/singleton.rb +7 -0
- data/spec/filters/unsupported/string.rb +687 -0
- data/spec/filters/unsupported/struct.rb +7 -0
- data/spec/filters/unsupported/symbol.rb +21 -0
- data/spec/filters/unsupported/taint.rb +162 -0
- data/spec/filters/unsupported/thread.rb +10 -0
- data/spec/filters/unsupported/time.rb +204 -0
- data/spec/filters/unsupported/usage_of_files.rb +262 -0
- data/spec/lib/builder_processors_spec.rb +44 -0
- data/spec/lib/builder_spec.rb +133 -0
- data/spec/lib/cli_runners/server_spec.rb +25 -0
- data/spec/lib/cli_runners_spec.rb +16 -0
- data/spec/lib/cli_spec.rb +256 -0
- data/spec/lib/compiler_spec.rb +693 -0
- data/spec/lib/config_spec.rb +112 -0
- data/spec/lib/dependency_resolver_spec.rb +43 -0
- data/spec/lib/deprecations_spec.rb +17 -0
- data/spec/lib/fixtures/complex_sprockets.js.rb.erb +4 -0
- data/spec/lib/fixtures/file_with_directives.js +2 -0
- data/spec/lib/fixtures/jst_file.js.jst +1 -0
- data/spec/lib/fixtures/no_requires.rb +1 -0
- data/spec/lib/fixtures/opal_file.rb +2 -0
- data/spec/lib/fixtures/require_tree_test.rb +3 -0
- data/spec/lib/fixtures/required_file.js +1 -0
- data/spec/lib/fixtures/required_tree_test/required_file1.rb +1 -0
- data/spec/lib/fixtures/required_tree_test/required_file2.rb +1 -0
- data/spec/lib/fixtures/requires.rb +7 -0
- data/spec/lib/fixtures/source_location_test.rb +7 -0
- data/spec/lib/fixtures/source_map.rb +1 -0
- data/spec/lib/fixtures/source_map/subfolder/other_file.rb +1 -0
- data/spec/lib/fixtures/sprockets_file.js.rb +3 -0
- data/spec/lib/fixtures/sprockets_require_tree_test.rb +3 -0
- data/spec/lib/path_reader_spec.rb +47 -0
- data/spec/lib/paths_spec.rb +18 -0
- data/spec/lib/repl_spec.rb +28 -0
- data/spec/lib/rewriters/base_spec.rb +68 -0
- data/spec/lib/rewriters/binary_operator_assignment_spec.rb +153 -0
- data/spec/lib/rewriters/block_to_iter_spec.rb +28 -0
- data/spec/lib/rewriters/dot_js_syntax_spec.rb +108 -0
- data/spec/lib/rewriters/explicit_writer_return_spec.rb +186 -0
- data/spec/lib/rewriters/for_rewriter_spec.rb +92 -0
- data/spec/lib/rewriters/hashes/key_duplicates_rewriter_spec.rb +47 -0
- data/spec/lib/rewriters/js_reserved_words_spec.rb +119 -0
- data/spec/lib/rewriters/logical_operator_assignment_spec.rb +202 -0
- data/spec/lib/rewriters/opal_engine_check_spec.rb +84 -0
- data/spec/lib/rewriters/returnable_logic_spec.rb +52 -0
- data/spec/lib/rewriters/rubyspec/filters_rewriter_spec.rb +59 -0
- data/spec/lib/simple_server_spec.rb +56 -0
- data/spec/lib/source_map/file_spec.rb +67 -0
- data/spec/lib/source_map/index_spec.rb +80 -0
- data/spec/lib/spec_helper.rb +105 -0
- data/spec/mspec-opal/formatters.rb +197 -0
- data/spec/mspec-opal/runner.rb +172 -0
- data/spec/opal/compiler/irb_spec.rb +44 -0
- data/spec/opal/compiler/unicode_spec.rb +10 -0
- data/spec/opal/core/array/dup_spec.rb +23 -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/class/inherited_spec.rb +18 -0
- data/spec/opal/core/enumerable/all_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/any_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/collect_break_spec.rb +13 -0
- data/spec/opal/core/enumerable/count_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/detect_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/drop_while_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/each_slice_break_spec.rb +6 -0
- data/spec/opal/core/enumerable/each_with_index_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/each_with_object_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/find_all_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/find_index_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/grep_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/max_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/max_by_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/min_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/min_by_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/none_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/one_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/reduce_break_spec.rb +5 -0
- data/spec/opal/core/enumerable/take_while_break_spec.rb +5 -0
- data/spec/opal/core/enumerator/with_index_spec.rb +6 -0
- data/spec/opal/core/exception_spec.rb +8 -0
- data/spec/opal/core/fixtures/require_tree_files/file 1.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/file 2.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/file 3.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/file 4.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/file 5.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/nested/nested 1.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/nested/nested 2.rb +1 -0
- data/spec/opal/core/fixtures/require_tree_files/other/other 1.rb +1 -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 +339 -0
- data/spec/opal/core/helpers_spec.rb +14 -0
- data/spec/opal/core/iterable_props_spec.rb +53 -0
- data/spec/opal/core/kernel/at_exit_spec.rb +70 -0
- data/spec/opal/core/kernel/freeze_spec.rb +15 -0
- data/spec/opal/core/kernel/instance_variables_spec.rb +110 -0
- data/spec/opal/core/kernel/methods_spec.rb +25 -0
- data/spec/opal/core/kernel/public_methods_spec.rb +25 -0
- data/spec/opal/core/kernel/require_tree_spec.rb +18 -0
- data/spec/opal/core/kernel/respond_to_spec.rb +15 -0
- data/spec/opal/core/language/DATA/characters_support_spec.rb +9 -0
- data/spec/opal/core/language/DATA/empty___END___spec.rb +7 -0
- data/spec/opal/core/language/DATA/multiple___END___spec.rb +10 -0
- data/spec/opal/core/language/arguments/mlhs_arg_spec.rb +18 -0
- data/spec/opal/core/language/keyword_arguments_spec.rb +9 -0
- data/spec/opal/core/language/numblocks_spec.rb +16 -0
- data/spec/opal/core/language/safe_navigator_spec.rb +7 -0
- data/spec/opal/core/language/while_spec.rb +31 -0
- data/spec/opal/core/language_spec.rb +29 -0
- data/spec/opal/core/marshal/dump_spec.rb +81 -0
- data/spec/opal/core/marshal/load_spec.rb +13 -0
- data/spec/opal/core/module_spec.rb +27 -0
- data/spec/opal/core/object_id_spec.rb +56 -0
- data/spec/opal/core/regexp/interpolation_spec.rb +40 -0
- data/spec/opal/core/regexp/match_spec.rb +78 -0
- data/spec/opal/core/runtime/bridged_classes_spec.rb +123 -0
- data/spec/opal/core/runtime/constants_spec.rb +16 -0
- data/spec/opal/core/runtime/eval_spec.rb +5 -0
- data/spec/opal/core/runtime/exit_spec.rb +29 -0
- data/spec/opal/core/runtime/is_a_spec.rb +48 -0
- data/spec/opal/core/runtime/loaded_spec.rb +20 -0
- data/spec/opal/core/runtime/main_methods_spec.rb +39 -0
- data/spec/opal/core/runtime/method_missing_spec.rb +68 -0
- data/spec/opal/core/runtime/rescue_spec.rb +37 -0
- data/spec/opal/core/runtime/string_spec.rb +25 -0
- data/spec/opal/core/runtime/truthy_spec.rb +61 -0
- data/spec/opal/core/runtime_spec.rb +58 -0
- data/spec/opal/core/string/each_byte_spec.rb +19 -0
- data/spec/opal/core/string/gsub_spec.rb +35 -0
- data/spec/opal/core/string/to_sym_spec.rb +9 -0
- data/spec/opal/core/string_spec.rb +28 -0
- data/spec/opal/core/struct/dup_spec.rb +11 -0
- data/spec/opal/core/time_spec.rb +68 -0
- data/spec/opal/stdlib/erb/erb_spec.rb +30 -0
- data/spec/opal/stdlib/erb/inline_block.opalerb +3 -0
- data/spec/opal/stdlib/erb/quoted.opalerb +1 -0
- data/spec/opal/stdlib/erb/simple.opalerb +1 -0
- data/spec/opal/stdlib/js_spec.rb +72 -0
- data/spec/opal/stdlib/json/ext_spec.rb +55 -0
- data/spec/opal/stdlib/json/parse_spec.rb +37 -0
- data/spec/opal/stdlib/logger/logger_spec.rb +308 -0
- data/spec/opal/stdlib/native/alias_native_spec.rb +27 -0
- data/spec/opal/stdlib/native/array_spec.rb +11 -0
- data/spec/opal/stdlib/native/date_spec.rb +12 -0
- data/spec/opal/stdlib/native/deprecated_include_spec.rb +8 -0
- data/spec/opal/stdlib/native/each_spec.rb +13 -0
- data/spec/opal/stdlib/native/element_reference_spec.rb +16 -0
- data/spec/opal/stdlib/native/exposure_spec.rb +33 -0
- data/spec/opal/stdlib/native/ext_spec.rb +19 -0
- data/spec/opal/stdlib/native/hash_spec.rb +67 -0
- data/spec/opal/stdlib/native/initialize_spec.rb +17 -0
- data/spec/opal/stdlib/native/method_missing_spec.rb +51 -0
- data/spec/opal/stdlib/native/native_alias_spec.rb +26 -0
- data/spec/opal/stdlib/native/native_class_spec.rb +18 -0
- data/spec/opal/stdlib/native/native_module_spec.rb +13 -0
- data/spec/opal/stdlib/native/native_reader_spec.rb +22 -0
- data/spec/opal/stdlib/native/native_writer_spec.rb +30 -0
- data/spec/opal/stdlib/native/new_spec.rb +92 -0
- data/spec/opal/stdlib/native/struct_spec.rb +12 -0
- data/spec/opal/stdlib/pp_spec.rb +5 -0
- data/spec/opal/stdlib/promise/always_spec.rb +49 -0
- data/spec/opal/stdlib/promise/error_spec.rb +15 -0
- data/spec/opal/stdlib/promise/rescue_spec.rb +53 -0
- data/spec/opal/stdlib/promise/then_spec.rb +79 -0
- data/spec/opal/stdlib/promise/trace_spec.rb +51 -0
- data/spec/opal/stdlib/promise/value_spec.rb +15 -0
- data/spec/opal/stdlib/promise/when_spec.rb +34 -0
- data/spec/opal/stdlib/source_map_spec.rb +8 -0
- data/spec/opal/stdlib/strscan/scan_spec.rb +11 -0
- data/spec/opal/stdlib/template/paths_spec.rb +10 -0
- data/spec/opal/stdlib/thread/mutex_spec.rb +40 -0
- data/spec/opal/stdlib/thread/thread_queue_spec.rb +32 -0
- data/spec/opal/stdlib/thread/thread_spec.rb +60 -0
- data/spec/ruby_specs +183 -0
- data/spec/spec_helper.rb +31 -0
- data/spec/support/guard_platform.rb +4 -0
- data/spec/support/match_helpers.rb +57 -0
- data/spec/support/mspec_rspec_adapter.rb +33 -0
- data/spec/support/rewriters_helper.rb +54 -0
- data/spec/support/source_map_helper.rb +190 -0
- data/stdlib/base64.rb +2 -2
- data/stdlib/bigdecimal.rb +15 -3
- data/stdlib/bigdecimal/bignumber.js.rb +1 -1
- data/stdlib/bigdecimal/util.rb +148 -0
- data/stdlib/delegate.rb +8 -0
- data/stdlib/nodejs/fileutils.rb +1 -1
- data/stdlib/nodejs/kernel.rb +0 -13
- data/stdlib/nodejs/stacktrace.rb +4 -179
- data/stdlib/ostruct.rb +5 -0
- data/stdlib/pp.rb +586 -19
- data/stdlib/prettyprint.rb +556 -0
- data/stdlib/rbconfig/sizeof.rb +2 -0
- data/stdlib/securerandom.rb +32 -0
- data/stdlib/set.rb +36 -0
- data/stdlib/strscan.rb +15 -0
- data/tasks/benchmarking.rake +1 -1
- data/tasks/releasing.rake +0 -3
- data/tasks/testing.rake +16 -11
- data/tasks/testing/mspec_special_calls.rb +1 -19
- data/test/nodejs/fixtures/cat.png +0 -0
- data/test/nodejs/fixtures/hello.rb +1 -0
- data/test/nodejs/fixtures/iso88591.txt +1 -0
- data/test/nodejs/fixtures/utf8.txt +1 -0
- data/test/nodejs/fixtures/win1258.txt +1 -0
- data/test/nodejs/test_dir.rb +39 -0
- data/test/nodejs/test_env.rb +62 -0
- data/test/nodejs/test_error.rb +29 -0
- data/test/nodejs/test_file.rb +206 -0
- data/test/nodejs/test_file_encoding.rb +20 -0
- data/test/nodejs/test_io.rb +18 -0
- data/test/nodejs/test_opal_builder.rb +12 -0
- data/test/nodejs/test_pathname.rb +16 -0
- data/test/opal/cat.png +0 -0
- data/test/opal/http_server.rb +52 -0
- data/test/opal/test_base64.rb +115 -0
- data/test/opal/test_keyword.rb +590 -0
- data/test/opal/test_matrix.rb +661 -0
- data/test/opal/test_openuri.rb +53 -0
- data/test/opal/unsupported_and_bugs.rb +39 -0
- data/yarn.lock +1114 -3
- metadata +889 -31
- data/lib/opal/nodes/runtime_helpers.rb +0 -51
- data/opal/corelib/random/MersenneTwister.js +0 -137
- data/opal/corelib/random/mersenne_twister.js.rb +0 -13
- data/stdlib/bigdecimal/kernel.rb +0 -5
@@ -1,3 +1,4 @@
|
|
1
|
+
require 'base64'
|
1
2
|
require 'corelib/pack_unpack/format_string_parser'
|
2
3
|
|
3
4
|
class String
|
@@ -234,23 +235,7 @@ class String
|
|
234
235
|
|
235
236
|
function base64Decode(callback) {
|
236
237
|
return function(data) {
|
237
|
-
|
238
|
-
if (typeof(atob) === 'function') {
|
239
|
-
// Browser
|
240
|
-
return atob(string);
|
241
|
-
} else if (typeof(Buffer) === 'function') {
|
242
|
-
// Node
|
243
|
-
if (typeof(Buffer.from) === 'function') {
|
244
|
-
// Node 5.10+
|
245
|
-
return Buffer.from(string, 'base64').toString();
|
246
|
-
} else {
|
247
|
-
return new Buffer(string, 'base64').toString();
|
248
|
-
}
|
249
|
-
} else if (#{defined?(Base64)}) {
|
250
|
-
return #{Base64.decode64(`string`)};
|
251
|
-
} else {
|
252
|
-
#{raise "To use String#unpack('m'), you must first require 'base64'."}
|
253
|
-
}
|
238
|
+
return #{Base64.decode64(`callback(data)`)};
|
254
239
|
}
|
255
240
|
}
|
256
241
|
|
data/opal/corelib/struct.rb
CHANGED
@@ -101,6 +101,17 @@ class Struct
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
def initialize_copy(from)
|
105
|
+
%x{
|
106
|
+
self.$$data = {}
|
107
|
+
var keys = Object.keys(from.$$data), i, max, name;
|
108
|
+
for (i = 0, max = keys.length; i < max; i++) {
|
109
|
+
name = keys[i];
|
110
|
+
self.$$data[name] = from.$$data[name];
|
111
|
+
}
|
112
|
+
}
|
113
|
+
end
|
114
|
+
|
104
115
|
def members
|
105
116
|
self.class.members
|
106
117
|
end
|
@@ -261,7 +272,9 @@ class Struct
|
|
261
272
|
|
262
273
|
alias to_s inspect
|
263
274
|
|
264
|
-
def to_h
|
275
|
+
def to_h(&block)
|
276
|
+
return map(&block).to_h(*args) if block_given?
|
277
|
+
|
265
278
|
self.class.members.each_with_object({}) { |name, h| h[name] = self[name] }
|
266
279
|
end
|
267
280
|
|
data/opal/corelib/time.rb
CHANGED
data/opal/opal.rb
CHANGED
data/opal/opal/mini.rb
CHANGED
data/package.json
CHANGED
data/spec/README.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
# Opal specs overview
|
2
|
+
|
3
|
+
* **ruby** the Ruby Spec Suite examples (submodule)
|
4
|
+
* **ruby_specs** (file) a whitelist of the Ruby Spec Suite files to be ran
|
5
|
+
* **filters** The list of the Ruby Spec Suite examples that are either bugs or unsupported
|
6
|
+
* **opal** opal additions/special behaviour in the runtime/corelib
|
7
|
+
* **lib** specs for opal lib (parser, lexer, grammar, compiler etc)
|
8
|
+
* **mspec** the MSpec library that runs the ruby spec
|
9
|
+
* **mspec-opal** Opal specific patches to the MSpec library
|
10
|
+
* **support** misc. utilities
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# NOTE: run bin/format-filters after changing this file
|
2
|
+
opal_filter "Array" do
|
3
|
+
fails "Array#* with an integer with a subclass of Array returns an Array instance" # Expected [] (ArraySpecs::MyArray) to be an instance of Array
|
4
|
+
fails "Array#== compares with an equivalent Array-like object using #to_ary" # Expected false to be true
|
5
|
+
fails "Array#== returns true for [NaN] == [NaN] because Array#== first checks with #equal? and NaN.equal?(NaN) is true" # Expected [NaN] to equal [NaN]
|
6
|
+
fails "Array#[] can accept beginless ranges" # Opal::SyntaxError: undefined method `type' for nil
|
7
|
+
fails "Array#[] can accept endless ranges" # Opal::SyntaxError: undefined method `type' for nil
|
8
|
+
fails "Array#[] can accept nil...nil ranges" # TypeError: no implicit conversion of NilClass into Integer
|
9
|
+
fails "Array#[] raises TypeError if to_int returns non-integer" # Expected TypeError but no exception was raised ([1, 2, 3, 4] was returned)
|
10
|
+
fails "Array#[] raises a RangeError if passed a range with a bound that is too large" # Expected RangeError but no exception was raised (nil was returned)
|
11
|
+
fails "Array#[] raises a type error if a range is passed with a length" # Expected TypeError but no exception was raised ([2, 3] was returned)
|
12
|
+
fails "Array#[] with a subclass of Array returns a Array instance with [-n, m]" # Expected [3, 4] (ArraySpecs::MyArray) to be an instance of Array
|
13
|
+
fails "Array#[] with a subclass of Array returns a Array instance with [-n..-m]" # Expected [3, 4, 5] (ArraySpecs::MyArray) to be an instance of Array
|
14
|
+
fails "Array#[] with a subclass of Array returns a Array instance with [-n...-m]" # Expected [3, 4] (ArraySpecs::MyArray) to be an instance of Array
|
15
|
+
fails "Array#[] with a subclass of Array returns a Array instance with [n, m]" # Expected [1, 2] (ArraySpecs::MyArray) to be an instance of Array
|
16
|
+
fails "Array#[] with a subclass of Array returns a Array instance with [n...m]" # Expected [2, 3] (ArraySpecs::MyArray) to be an instance of Array
|
17
|
+
fails "Array#[] with a subclass of Array returns a Array instance with [n..m]" # Expected [2, 3, 4] (ArraySpecs::MyArray) to be an instance of Array
|
18
|
+
fails "Array#[]= with [..n] and [...n] inserts at the beginning if n < negative the array size" # Opal::SyntaxError: undefined method `type' for nil
|
19
|
+
fails "Array#[]= with [..n] and [...n] just sets the section defined by range to nil even if the rhs is nil" # Opal::SyntaxError: undefined method `type' for nil
|
20
|
+
fails "Array#[]= with [..n] and [...n] just sets the section defined by range to nil if n < 0 and the rhs is nil" # Opal::SyntaxError: undefined method `type' for nil
|
21
|
+
fails "Array#[]= with [..n] and [...n] replaces everything if n > the array size" # Opal::SyntaxError: undefined method `type' for nil
|
22
|
+
fails "Array#[]= with [..n] and [...n] replaces the section defined by range" # Opal::SyntaxError: undefined method `type' for nil
|
23
|
+
fails "Array#[]= with [..n] and [...n] replaces the section if n < 0" # Opal::SyntaxError: undefined method `type' for nil
|
24
|
+
fails "Array#[]= with [m..] inserts at the end if m > the array size" # Opal::SyntaxError: undefined method `type' for nil
|
25
|
+
fails "Array#[]= with [m..] just sets the section defined by range to nil even if the rhs is nil" # Opal::SyntaxError: undefined method `type' for nil
|
26
|
+
fails "Array#[]= with [m..] just sets the section defined by range to nil if m and n < 0 and the rhs is nil" # Opal::SyntaxError: undefined method `type' for nil
|
27
|
+
fails "Array#[]= with [m..] replaces the section defined by range" # Opal::SyntaxError: undefined method `type' for nil
|
28
|
+
fails "Array#[]= with [m..] replaces the section if m and n < 0" # Opal::SyntaxError: undefined method `type' for nil
|
29
|
+
fails "Array#deconstruct returns self" # NoMethodError: undefined method `deconstruct' for [1]
|
30
|
+
fails "Array#difference accepts multiple arguments" # NoMethodError: undefined method `difference' for [1, 2, 3, 1]
|
31
|
+
fails "Array#difference does not return subclass instances for Array subclasses" # NoMethodError: undefined method `difference' for [1, 2, 3]
|
32
|
+
fails "Array#difference returns a copy when called without any parameter" # NoMethodError: undefined method `difference' for [1, 2, 3, 2]
|
33
|
+
fails "Array#drop raises a TypeError when the passed argument can't be coerced to Integer" # Expected TypeError but no exception was raised ([1, 2] was returned)
|
34
|
+
fails "Array#drop raises a TypeError when the passed argument isn't an integer and #to_int returns non-Integer" # Expected TypeError but no exception was raised ([1, 2] was returned)
|
35
|
+
fails "Array#drop tries to convert the passed argument to an Integer using #to_int" # Expected [1, 2, 3] == [3] to be truthy but was false
|
36
|
+
fails "Array#each does not yield elements deleted from the end of the array" # Expected [2, 3, nil] to equal [2, 3]
|
37
|
+
fails "Array#each yields elements added to the end of the array by the block" # Expected [2] to equal [2, 0, 0]
|
38
|
+
fails "Array#fill with (filler, range) works with beginless ranges" # Opal::SyntaxError: undefined method `type' for nil
|
39
|
+
fails "Array#fill with (filler, range) works with endless ranges" # Opal::SyntaxError: undefined method `type' for nil
|
40
|
+
fails "Array#filter returns a new array of elements for which block is true" # NoMethodError: undefined method `filter' for [1, 3, 4, 5, 6, 9]
|
41
|
+
fails "Array#flatten does not call #to_ary on elements beyond the given level"
|
42
|
+
fails "Array#flatten performs respond_to? and method_missing-aware checks when coercing elements to array"
|
43
|
+
fails "Array#flatten returns Array instance for Array subclasses" # Expected [] (ArraySpecs::MyArray) to be an instance of Array
|
44
|
+
fails "Array#flatten with a non-Array object in the Array calls #method_missing if defined"
|
45
|
+
fails "Array#inspect does not call #to_str on the object returned from #to_s when it is not a String" # Exception: Cannot convert object to primitive value
|
46
|
+
fails "Array#intersection accepts multiple arguments" # NoMethodError: undefined method `intersection' for [1, 2, 3, 4]
|
47
|
+
fails "Array#join raises a NoMethodError if an element does not respond to #to_str, #to_ary, or #to_s"
|
48
|
+
fails "Array#partition returns in the left array values for which the block evaluates to true"
|
49
|
+
fails "Array#rassoc calls elem == obj on the second element of each contained array"
|
50
|
+
fails "Array#rassoc does not check the last element in each contained but specifically the second" # Expected [1, "foobar", #<MockObject:0x4ef6e>] to equal [2, #<MockObject:0x4ef6e>, 1]
|
51
|
+
fails "Array#select returns a new array of elements for which block is true"
|
52
|
+
fails "Array#slice can accept beginless ranges" # Opal::SyntaxError: undefined method `type' for nil
|
53
|
+
fails "Array#slice can accept endless ranges" # Opal::SyntaxError: undefined method `type' for nil
|
54
|
+
fails "Array#slice can accept nil...nil ranges" # TypeError: no implicit conversion of NilClass into Integer
|
55
|
+
fails "Array#slice raises TypeError if to_int returns non-integer" # Expected TypeError but no exception was raised ([1, 2, 3, 4] was returned)
|
56
|
+
fails "Array#slice raises a RangeError if passed a range with a bound that is too large" # Expected RangeError but no exception was raised (nil was returned)
|
57
|
+
fails "Array#slice raises a type error if a range is passed with a length" # Expected TypeError but no exception was raised ([2, 3] was returned)
|
58
|
+
fails "Array#slice with a subclass of Array returns a Array instance with [-n, m]" # Expected [3, 4] (ArraySpecs::MyArray) to be an instance of Array
|
59
|
+
fails "Array#slice with a subclass of Array returns a Array instance with [-n..-m]" # Expected [3, 4, 5] (ArraySpecs::MyArray) to be an instance of Array
|
60
|
+
fails "Array#slice with a subclass of Array returns a Array instance with [-n...-m]" # Expected [3, 4] (ArraySpecs::MyArray) to be an instance of Array
|
61
|
+
fails "Array#slice with a subclass of Array returns a Array instance with [n, m]" # Expected [1, 2] (ArraySpecs::MyArray) to be an instance of Array
|
62
|
+
fails "Array#slice with a subclass of Array returns a Array instance with [n...m]" # Expected [2, 3] (ArraySpecs::MyArray) to be an instance of Array
|
63
|
+
fails "Array#slice with a subclass of Array returns a Array instance with [n..m]" # Expected [2, 3, 4] (ArraySpecs::MyArray) to be an instance of Array
|
64
|
+
fails "Array#slice! works with beginless ranges" # Opal::SyntaxError: undefined method `type' for nil
|
65
|
+
fails "Array#slice! works with endless ranges" # Opal::SyntaxError: undefined method `type' for nil
|
66
|
+
fails "Array#to_h with block does not coerce returned pair to Array with #to_a" # Expected TypeError (/wrong element type MockObject at 0/) but got: TypeError (wrong element type NilClass at 0 (expected array))
|
67
|
+
fails "Array#to_h with block raises TypeError if block returns something other than Array" # Expected TypeError (/wrong element type String at 0/) but got: TypeError (wrong element type NilClass at 0 (expected array))
|
68
|
+
fails "Array#to_s does not call #to_str on the object returned from #to_s when it is not a String" # Exception: Cannot convert object to primitive value
|
69
|
+
fails "Array#union accepts multiple arguments" # NoMethodError: undefined method `union' for [1, 2, 3]
|
70
|
+
fails "Array#union does not return subclass instances for Array subclasses"
|
71
|
+
fails "Array#union returns unique elements when given no argument" # NoMethodError: undefined method `union' for [1, 2, 3, 2]
|
72
|
+
fails "Array#uniq returns Array instance on Array subclasses" # Expected [1, 2, 3] (ArraySpecs::MyArray) to be an instance of Array
|
73
|
+
fails "Array#uniq! properly handles recursive arrays"
|
74
|
+
fails "Array#values_at works when given beginless ranges" # Opal::SyntaxError: undefined method `type' for nil
|
75
|
+
fails "Array#values_at works when given endless ranges" # Opal::SyntaxError: undefined method `type' for nil
|
76
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
# NOTE: run bin/format-filters after changing this file
|
2
|
+
opal_filter "Base64" do
|
3
|
+
fails "Base64#decode64 returns a binary encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
|
4
|
+
fails "Base64#decode64 returns the Base64-decoded version of the given string with wrong padding" # Expected "]M\u0095¹\u0090\u0081É\u0095¥¹\u0099½É\u008D\u0095µ\u0095¹ÑÌ" == "]M\u0095¹\u0090\u0081ɕ¥¹\u0099½ɍ\u0095µ\u0095¹ÑÌ" to be truthy but was false
|
5
|
+
fails "Base64#encode64 returns a US_ASCII encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
|
6
|
+
fails "Base64#strict_decode64 raises ArgumentError when the given string contains an invalid character" # Expected ArgumentError but no exception was raised ("Ü" was returned)
|
7
|
+
fails "Base64#strict_decode64 raises ArgumentError when the given string has wrong padding" # Expected ArgumentError but no exception was raised ("\u0001M\u0095¹\u0090\u0081É\u0095¥¹\u0099½É\u008D\u0095µ\u0095¹ÑÌ" was returned)
|
8
|
+
fails "Base64#strict_decode64 returns a binary encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
|
9
|
+
fails "Base64#strict_encode64 returns a US_ASCII encoded string" # Expected #<Encoding:UTF-8> == #<Encoding:ASCII-8BIT (dummy)> to be truthy but was false
|
10
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# NOTE: run bin/format-filters after changing this file
|
2
|
+
opal_filter "BasicObject" do
|
3
|
+
fails "BasicObject raises NoMethodError for nonexistent methods after #method_missing is removed"
|
4
|
+
fails "BasicObject#__send__ raises a TypeError if the method name is not a string or symbol" # NoMethodError: undefined method `' for SendSpecs
|
5
|
+
fails "BasicObject#initialize does not accept arguments"
|
6
|
+
fails "BasicObject#instance_eval evaluates string with given filename and linenumber"
|
7
|
+
fails "BasicObject#instance_eval evaluates string with given filename and negative linenumber" # Expected ["RuntimeError"] to equal ["b_file", "-98"]
|
8
|
+
fails "BasicObject#instance_eval has access to the caller's local variables" # Expected nil to equal "value"
|
9
|
+
fails "BasicObject#instance_exec binds the block's binding self to the receiver"
|
10
|
+
fails "BasicObject#instance_exec raises a LocalJumpError unless given a block"
|
11
|
+
fails "BasicObject#method_missing for an instance sets the receiver of the raised NoMethodError"
|
12
|
+
end
|
@@ -0,0 +1,248 @@
|
|
1
|
+
# NOTE: run bin/format-filters after changing this file
|
2
|
+
opal_filter "BigDecimal" do
|
3
|
+
fails "BidDecimal#hash two BigDecimal objects with numerically equal values should have the same hash value" # Exception: self.$BigDecimal(...).$hash is not a function
|
4
|
+
fails "BidDecimal#hash two BigDecimal objects with the same value should have the same hash for NaNs" # Exception: self.$BigDecimal(...).$hash is not a function
|
5
|
+
fails "BidDecimal#hash two BigDecimal objects with the same value should have the same hash for infinite values" # Exception: self.$BigDecimal(...).$hash is not a function
|
6
|
+
fails "BidDecimal#hash two BigDecimal objects with the same value should have the same hash for ordinary values" # Exception: self.$BigDecimal(...).$hash is not a function
|
7
|
+
fails "BidDecimal#hash two BigDecimal objects with the same value should have the same hash for zero values" # Exception: self.$BigDecimal(...).$hash is not a function
|
8
|
+
fails "BigDecimal constants defines a VERSION value" # Expected false to be true
|
9
|
+
fails "BigDecimal constants exception-related constants has a EXCEPTION_ALL value" # NameError: uninitialized constant BigDecimal::EXCEPTION_ALL
|
10
|
+
fails "BigDecimal constants exception-related constants has a EXCEPTION_INFINITY value" # NameError: uninitialized constant BigDecimal::EXCEPTION_INFINITY
|
11
|
+
fails "BigDecimal constants exception-related constants has a EXCEPTION_NaN value" # NameError: uninitialized constant BigDecimal::EXCEPTION_NaN
|
12
|
+
fails "BigDecimal constants exception-related constants has a EXCEPTION_OVERFLOW value" # NameError: uninitialized constant BigDecimal::EXCEPTION_OVERFLOW
|
13
|
+
fails "BigDecimal constants exception-related constants has a EXCEPTION_UNDERFLOW value" # NameError: uninitialized constant BigDecimal::EXCEPTION_UNDERFLOW
|
14
|
+
fails "BigDecimal constants exception-related constants has a EXCEPTION_ZERODIVIDE value" # NameError: uninitialized constant BigDecimal::EXCEPTION_ZERODIVIDE
|
15
|
+
fails "BigDecimal constants has a BASE value" # NameError: uninitialized constant BigDecimal::BASE
|
16
|
+
fails "BigDecimal constants has a NaN value" # NameError: uninitialized constant BigDecimal::NAN
|
17
|
+
fails "BigDecimal constants has an INFINITY value" # NameError: uninitialized constant BigDecimal::INFINITY
|
18
|
+
fails "BigDecimal constants rounding-related constants has a ROUND_CEILING value" # Expected 2 to equal 5
|
19
|
+
fails "BigDecimal constants rounding-related constants has a ROUND_DOWN value" # Expected 1 to equal 2
|
20
|
+
fails "BigDecimal constants rounding-related constants has a ROUND_FLOOR value" # Expected 3 to equal 6
|
21
|
+
fails "BigDecimal constants rounding-related constants has a ROUND_HALF_DOWN value" # Expected 5 to equal 4
|
22
|
+
fails "BigDecimal constants rounding-related constants has a ROUND_HALF_EVEN value" # Expected 6 to equal 7
|
23
|
+
fails "BigDecimal constants rounding-related constants has a ROUND_HALF_UP value" # Expected 4 to equal 3
|
24
|
+
fails "BigDecimal constants rounding-related constants has a ROUND_UP value" # Expected 0 to equal 1
|
25
|
+
fails "BigDecimal is not defined unless it is required" # NoMethodError: undefined method `tmp' for #<MSpecEnv:0xbe6e>
|
26
|
+
fails "BigDecimal#% returns NaN if NaN is involved"
|
27
|
+
fails "BigDecimal#% returns NaN if the dividend is Infinity"
|
28
|
+
fails "BigDecimal#% returns self modulo other"
|
29
|
+
fails "BigDecimal#% returns the dividend if the divisor is Infinity"
|
30
|
+
fails "BigDecimal#% with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(6543.21) exactly 1 times but received it 0 times
|
31
|
+
fails "BigDecimal#* with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(3e-20001) exactly 1 times but received it 0 times
|
32
|
+
fails "BigDecimal#* with Rational produces a BigDecimal" # Exception: lhs.$* is not a function
|
33
|
+
fails "BigDecimal#** 0 to power of 0 is 1"
|
34
|
+
fails "BigDecimal#** 0 to powers < 0 is Infinity"
|
35
|
+
fails "BigDecimal#** other powers of 0 are 0"
|
36
|
+
fails "BigDecimal#** powers of 1 equal 1"
|
37
|
+
fails "BigDecimal#** powers of self"
|
38
|
+
fails "BigDecimal#** returns 0.0 if self is infinite and argument is negative"
|
39
|
+
fails "BigDecimal#** returns NaN if self is NaN"
|
40
|
+
fails "BigDecimal#** returns infinite if self is infinite and argument is positive"
|
41
|
+
fails "BigDecimal#+ with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(1) exactly 1 times but received it 0 times
|
42
|
+
fails "BigDecimal#- with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(1) exactly 1 times but received it 0 times
|
43
|
+
fails "BigDecimal#-@ properly handles special values"
|
44
|
+
fails "BigDecimal#/ returns a / b" #fails a single assertion: @one.send(@method, BigDecimal('-2E5555'), *@object).should == BigDecimal('-0.5E-5555')
|
45
|
+
fails "BigDecimal#/ with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(1) exactly 1 times but received it 0 times
|
46
|
+
fails "BigDecimal#/ with Rational produces a BigDecimal" # Exception: lhs.$/ is not a function
|
47
|
+
fails "BigDecimal#< properly handles infinity values" #fails only with mock object
|
48
|
+
fails "BigDecimal#<= properly handles infinity values" #fails only with mock object
|
49
|
+
fails "BigDecimal#<=> returns -1 if a < b" #fails only with mock object
|
50
|
+
fails "BigDecimal#<=> returns 1 if a > b" #fails only with mock object
|
51
|
+
fails "BigDecimal#> properly handles infinity values" #fails only with mock object
|
52
|
+
fails "BigDecimal#>= properly handles infinity values" #fails only with mock object
|
53
|
+
fails "BigDecimal#add with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(123450000000000) exactly 1 times but received it 0 times
|
54
|
+
fails "BigDecimal#add with Rational produces a BigDecimal" # Exception: lhs.$+ is not a function
|
55
|
+
fails "BigDecimal#ceil returns the smallest integer greater or equal to self, if n is unspecified"
|
56
|
+
fails "BigDecimal#ceil sets n digits left of the decimal point to 0, if given n < 0"
|
57
|
+
fails "BigDecimal#coerce returns [other, self] both as BigDecimal"
|
58
|
+
fails "BigDecimal#div returns a / b with optional precision" #fails the case of > 20 decimal places for to_s('F')
|
59
|
+
fails "BigDecimal#div with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(1) exactly 1 times but received it 0 times
|
60
|
+
fails "BigDecimal#div with precision set to 0 returns a / b" #fails a single assertion: @one.send(@method, BigDecimal('-2E5555'), *@object).should == BigDecimal('-0.5E-5555')
|
61
|
+
fails "BigDecimal#div with precision set to 0 with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(1) exactly 1 times but received it 0 times
|
62
|
+
fails "BigDecimal#divmod array contains quotient and modulus as BigDecimal"
|
63
|
+
fails "BigDecimal#divmod can be reversed with * and +" # Expected 0 to equal -1
|
64
|
+
fails "BigDecimal#divmod returns an array of Infinity and NaN if the dividend is Infinity"
|
65
|
+
fails "BigDecimal#divmod returns an array of two NaNs if NaN is involved"
|
66
|
+
fails "BigDecimal#divmod returns an array of zero and the dividend if the divisor is Infinity"
|
67
|
+
fails "BigDecimal#exponent is n if number can be represented as 0.xxx*10**n"
|
68
|
+
fails "BigDecimal#exponent returns 0 if self is 0"
|
69
|
+
fails "BigDecimal#exponent returns an Integer"
|
70
|
+
fails "BigDecimal#fix correctly handles special values"
|
71
|
+
fails "BigDecimal#fix does not allow any arguments"
|
72
|
+
fails "BigDecimal#fix returns 0 if the absolute value is < 1"
|
73
|
+
fails "BigDecimal#fix returns a BigDecimal"
|
74
|
+
fails "BigDecimal#fix returns the integer part of the absolute value"
|
75
|
+
fails "BigDecimal#floor raise exception, if self is special value"
|
76
|
+
fails "BigDecimal#floor returns the greatest integer smaller or equal to self"
|
77
|
+
fails "BigDecimal#floor sets n digits left of the decimal point to 0, if given n < 0"
|
78
|
+
fails "BigDecimal#frac correctly handles special values"
|
79
|
+
fails "BigDecimal#frac returns 0 if the value is 0"
|
80
|
+
fails "BigDecimal#frac returns 0 if the value is an integer"
|
81
|
+
fails "BigDecimal#frac returns a BigDecimal"
|
82
|
+
fails "BigDecimal#frac returns the fractional part of the absolute value"
|
83
|
+
fails "BigDecimal#inspect does not add an exponent for zero values" # Exception: self.$BigDecimal(...).$inspect is not a function
|
84
|
+
fails "BigDecimal#inspect encloses information in angle brackets"
|
85
|
+
fails "BigDecimal#inspect is comma separated list of three items"
|
86
|
+
fails "BigDecimal#inspect last part is number of significant digits"
|
87
|
+
fails "BigDecimal#inspect looks like this"
|
88
|
+
fails "BigDecimal#inspect returns String starting with #"
|
89
|
+
fails "BigDecimal#inspect value after first comma is value as string"
|
90
|
+
fails "BigDecimal#mod_part_of_divmod returns NaN if NaN is involved"
|
91
|
+
fails "BigDecimal#mod_part_of_divmod returns NaN if the dividend is Infinity"
|
92
|
+
fails "BigDecimal#mod_part_of_divmod returns self modulo other"
|
93
|
+
fails "BigDecimal#mod_part_of_divmod returns the dividend if the divisor is Infinity"
|
94
|
+
fails "BigDecimal#mod_part_of_divmod with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(6543.21) exactly 1 times but received it 0 times
|
95
|
+
fails "BigDecimal#modulo returns NaN if NaN is involved" # FloatDomainError: Computation results to 'NaN'(Not a Number)
|
96
|
+
fails "BigDecimal#modulo returns NaN if the dividend is Infinity" # FloatDomainError: Computation results to 'Infinity'
|
97
|
+
fails "BigDecimal#modulo returns self modulo other" # Exception: new BigNumber() number type has more than 15 significant digits: 9223372036854776000
|
98
|
+
fails "BigDecimal#modulo returns the dividend if the divisor is Infinity" # Expected NaN to equal 1
|
99
|
+
fails "BigDecimal#modulo with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(6543.21) exactly 1 times but received it 0 times
|
100
|
+
fails "BigDecimal#mult with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(3e-20001) exactly 1 times but received it 0 times
|
101
|
+
fails "BigDecimal#power 0 to power of 0 is 1"
|
102
|
+
fails "BigDecimal#power 0 to powers < 0 is Infinity"
|
103
|
+
fails "BigDecimal#power other powers of 0 are 0"
|
104
|
+
fails "BigDecimal#power powers of 1 equal 1"
|
105
|
+
fails "BigDecimal#power powers of self"
|
106
|
+
fails "BigDecimal#power returns 0.0 if self is infinite and argument is negative"
|
107
|
+
fails "BigDecimal#power returns NaN if self is NaN"
|
108
|
+
fails "BigDecimal#power returns infinite if self is infinite and argument is positive"
|
109
|
+
fails "BigDecimal#precs returns Integers as array values"
|
110
|
+
fails "BigDecimal#precs returns array of two values"
|
111
|
+
fails "BigDecimal#precs returns the current value of significant digits as the first value"
|
112
|
+
fails "BigDecimal#precs returns the maximum number of significant digits as the second value"
|
113
|
+
fails "BigDecimal#quo returns a / b" #fails a single assertion: @one.send(@method, BigDecimal('-2E5555'), *@object).should == BigDecimal('-0.5E-5555')
|
114
|
+
fails "BigDecimal#quo with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(1) exactly 1 times but received it 0 times
|
115
|
+
fails "BigDecimal#remainder coerces arguments to BigDecimal if possible"
|
116
|
+
fails "BigDecimal#remainder it equals modulo, if both values are of same sign"
|
117
|
+
fails "BigDecimal#remainder means self-arg*(self/arg).truncate"
|
118
|
+
fails "BigDecimal#remainder raises TypeError if the argument cannot be coerced to BigDecimal"
|
119
|
+
fails "BigDecimal#remainder returns NaN if Infinity is involved"
|
120
|
+
fails "BigDecimal#remainder returns NaN if NaN is involved"
|
121
|
+
fails "BigDecimal#remainder returns NaN used with zero"
|
122
|
+
fails "BigDecimal#remainder returns zero if used on zero"
|
123
|
+
fails "BigDecimal#remainder with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(3) exactly 1 times but received it 0 times
|
124
|
+
fails "BigDecimal#round :banker rounds values > 5 up, < 5 down and == 5 towards even neighbor" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
125
|
+
fails "BigDecimal#round :ceil rounds values towards +infinity" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
126
|
+
fails "BigDecimal#round :ceiling rounds values towards +infinity" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
127
|
+
fails "BigDecimal#round :default rounds values >= 5 up, otherwise down" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
128
|
+
fails "BigDecimal#round :down rounds values towards zero" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
129
|
+
fails "BigDecimal#round :floor rounds values towards -infinity" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
130
|
+
fails "BigDecimal#round :half_down rounds values > 5 up, otherwise down" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
131
|
+
fails "BigDecimal#round :half_even rounds values > 5 up, < 5 down and == 5 towards even neighbor" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
132
|
+
fails "BigDecimal#round :half_up rounds values >= 5 up, otherwise down" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
133
|
+
fails "BigDecimal#round :truncate rounds values towards zero" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
134
|
+
fails "BigDecimal#round :up rounds values away from zero" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
135
|
+
fails "BigDecimal#round BigDecimal::ROUND_CEILING rounds values towards +infinity" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
136
|
+
fails "BigDecimal#round BigDecimal::ROUND_DOWN rounds values towards zero" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
137
|
+
fails "BigDecimal#round BigDecimal::ROUND_FLOOR rounds values towards -infinity" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
138
|
+
fails "BigDecimal#round BigDecimal::ROUND_HALF_DOWN rounds values > 5 up, otherwise down" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
139
|
+
fails "BigDecimal#round BigDecimal::ROUND_HALF_EVEN rounds values > 5 up, < 5 down and == 5 towards even neighbor" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
140
|
+
fails "BigDecimal#round BigDecimal::ROUND_HALF_UP rounds values >= 5 up, otherwise down" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
141
|
+
fails "BigDecimal#round BigDecimal::ROUND_UP rounds values away from zero" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
142
|
+
fails "BigDecimal#round raise for a non-existent round mode" # ArgumentError: [BigDecimal#round] wrong number of arguments(2 for -1)
|
143
|
+
fails "BigDecimal#round uses default rounding method unless given"
|
144
|
+
fails "BigDecimal#sign returns negative value if BigDecimal less than 0"
|
145
|
+
fails "BigDecimal#sign returns positive value if BigDecimal greater than 0"
|
146
|
+
fails "BigDecimal#split first value: -1 for numbers < 0" # NoMethodError: undefined method `split' for 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593014782083152134043
|
147
|
+
fails "BigDecimal#split first value: 0 if BigDecimal is NaN" # NoMethodError: undefined method `split' for 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593014782083152134043
|
148
|
+
fails "BigDecimal#split first value: 1 for numbers > 0" # NoMethodError: undefined method `split' for 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593014782083152134043
|
149
|
+
fails "BigDecimal#split fourth value: the exponent" # NoMethodError: undefined method `split' for 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593014782083152134043
|
150
|
+
fails "BigDecimal#split second value: a string with the significant digits" # NoMethodError: undefined method `split' for 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593014782083152134043
|
151
|
+
fails "BigDecimal#split splits BigDecimal in an array with four values"
|
152
|
+
fails "BigDecimal#split third value: the base (currently always ten)" # NoMethodError: undefined method `split' for 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593014782083152134043
|
153
|
+
fails "BigDecimal#sqrt raises ArgumentError if 2 arguments are given"
|
154
|
+
fails "BigDecimal#sqrt raises ArgumentError if a negative number is given"
|
155
|
+
fails "BigDecimal#sqrt raises ArgumentError when no argument is given"
|
156
|
+
fails "BigDecimal#sqrt raises FloatDomainError for NaN"
|
157
|
+
fails "BigDecimal#sqrt raises FloatDomainError for negative infinity"
|
158
|
+
fails "BigDecimal#sqrt raises FloatDomainError on negative values"
|
159
|
+
fails "BigDecimal#sqrt raises TypeError if a plain Object is given"
|
160
|
+
fails "BigDecimal#sqrt raises TypeError if a string is given"
|
161
|
+
fails "BigDecimal#sqrt raises TypeError if nil is given"
|
162
|
+
fails "BigDecimal#sqrt returns 0 for 0, +0.0 and -0.0"
|
163
|
+
fails "BigDecimal#sqrt returns 1 if precision is 0 or 1"
|
164
|
+
fails "BigDecimal#sqrt returns positive infinity for infinity" # NoMethodError: undefined method `sqrt' for Infinity
|
165
|
+
fails "BigDecimal#sqrt returns positive infitinity for infinity"
|
166
|
+
fails "BigDecimal#sqrt returns square root of 0.9E-99999 with desired precision"
|
167
|
+
fails "BigDecimal#sqrt returns square root of 121 with desired precision"
|
168
|
+
fails "BigDecimal#sqrt returns square root of 2 with desired precision"
|
169
|
+
fails "BigDecimal#sqrt returns square root of 3 with desired precision"
|
170
|
+
fails "BigDecimal#sub with Object tries to coerce the other operand to self" # Mock 'Object' expected to receive coerce(123450000000000) exactly 1 times but received it 0 times
|
171
|
+
fails "BigDecimal#sub with Rational produces a BigDecimal" # Exception: lhs.$- is not a function
|
172
|
+
fails "BigDecimal#to_f properly handles special values"
|
173
|
+
fails "BigDecimal#to_f remembers negative zero when converted to float"
|
174
|
+
fails "BigDecimal#to_i raises FloatDomainError if BigDecimal is infinity or NaN"
|
175
|
+
fails "BigDecimal#to_i returns Integer or Bignum otherwise"
|
176
|
+
fails "BigDecimal#to_i returns Integer otherwise" # NoMethodError: undefined method `to_i' for 3e-20001
|
177
|
+
fails "BigDecimal#to_int raises FloatDomainError if BigDecimal is infinity or NaN"
|
178
|
+
fails "BigDecimal#to_int returns Integer or Bignum otherwise"
|
179
|
+
fails "BigDecimal#to_int returns Integer otherwise" # NoMethodError: undefined method `to_i' for 3e-20001
|
180
|
+
fails "BigDecimal#to_r returns a Rational with bignum values" # NoMethodError: undefined method `to_r' for 3.141592653589793238462643
|
181
|
+
fails "BigDecimal#to_r returns a Rational" # NoMethodError: undefined method `to_r' for 3.14159
|
182
|
+
fails "BigDecimal#to_s can return a leading space for values > 0"
|
183
|
+
fails "BigDecimal#to_s can use conventional floating point notation"
|
184
|
+
fails "BigDecimal#to_s can use engineering notation"
|
185
|
+
fails "BigDecimal#to_s does not add an exponent for zero values" # Exception: self.$BigDecimal(...).$to_s is not a function
|
186
|
+
fails "BigDecimal#to_s inserts a space every n chars, if integer n is supplied"
|
187
|
+
fails "BigDecimal#to_s removes trailing spaces in floating point notation"
|
188
|
+
fails "BigDecimal#to_s return type is of class String" # Exception: self.bigdec.$to_s is not a function
|
189
|
+
fails "BigDecimal#to_s returns a String in US-ASCII encoding when Encoding.default_internal is nil" # NoMethodError: undefined method `default_internal' for Encoding
|
190
|
+
fails "BigDecimal#to_s returns a String in US-ASCII encoding when Encoding.default_internal is not nil" # NoMethodError: undefined method `default_internal' for Encoding
|
191
|
+
fails "BigDecimal#to_s starts with + if + is supplied and value is positive"
|
192
|
+
fails "BigDecimal#to_s takes an optional argument" # Expected to not get Exception
|
193
|
+
fails "BigDecimal#to_s the default format looks like 0.xxxxEnn"
|
194
|
+
fails "BigDecimal#to_s the default format looks like 0.xxxxenn" # Expected "3.14159265358979323846264338327950288419716939937" to match /^0\.[0-9]*e[0-9]*$/
|
195
|
+
fails "BigDecimal#truncate returns Infinity if self is infinite"
|
196
|
+
fails "BigDecimal#truncate returns the same value if self is special value"
|
197
|
+
fails "BigDecimal#truncate returns value of given precision otherwise"
|
198
|
+
fails "BigDecimal.double_fig returns the number of digits a Float number is allowed to have"
|
199
|
+
fails "BigDecimal.limit picks the global precision when limit 0 specified" # Expected 0.8888 to equal 0.889
|
200
|
+
fails "BigDecimal.limit picks the specified precision over global limit" # Expected 0.888 to equal 0.89
|
201
|
+
fails "BigDecimal.limit returns the value before set if the passed argument is nil or is not specified"
|
202
|
+
fails "BigDecimal.limit use the global limit if no precision is specified"
|
203
|
+
fails "BigDecimal.limit uses the global limit if no precision is specified" # Expected 0.888 to equal 0.9
|
204
|
+
fails "BigDecimal.mode raise an exception if the flag is true"
|
205
|
+
fails "BigDecimal.mode returns Infinity when too big"
|
206
|
+
fails "BigDecimal.mode returns the appropriate value and continue the computation if the flag is false"
|
207
|
+
fails "BigDecimal.new accepts significant digits >= given precision" # NoMethodError: undefined method `precs' for 3.1415923
|
208
|
+
fails "BigDecimal.new allows for [eEdD] as exponent separator"
|
209
|
+
fails "BigDecimal.new allows for underscores in all parts"
|
210
|
+
fails "BigDecimal.new creates a new object of class BigDecimal"
|
211
|
+
fails "BigDecimal.new determines precision from initial value"
|
212
|
+
fails "BigDecimal.new ignores trailing garbage"
|
213
|
+
fails "BigDecimal.new raises ArgumentError for invalid strings" # Exception: new BigNumber() not a number: ruby
|
214
|
+
fails "BigDecimal.new raises ArgumentError when Float is used without precision"
|
215
|
+
fails "BigDecimal.new treats invalid strings as 0.0"
|
216
|
+
fails "BigDecimal.ver returns the Version number"
|
217
|
+
fails "Float#to_d returns appropriate BigDecimal zero for signed zero" # NoMethodError: undefined method `to_d' for 0
|
218
|
+
fails "Kernel#BigDecimal BigDecimal(Rational) with bigger-than-double numerator" # Expected 1000000000000000000 > 18446744073709552000 to be truthy but was false
|
219
|
+
fails "Kernel#BigDecimal accepts significant digits >= given precision" # NoMethodError: undefined method `precs' for 3.1415923
|
220
|
+
fails "Kernel#BigDecimal allows for [eEdD] as exponent separator" # Exception: new BigNumber() not a number: 12345.67d89
|
221
|
+
fails "Kernel#BigDecimal allows for underscores in all parts" # Exception: new BigNumber() not a number: 12_345.67E89
|
222
|
+
fails "Kernel#BigDecimal coerces the value argument with #to_str" # Exception: new BigNumber() not a number: #<MockObject:0x666>
|
223
|
+
fails "Kernel#BigDecimal creates a new object of class BigDecimal" # Expected 1 to equal (1/1)
|
224
|
+
fails "Kernel#BigDecimal determines precision from initial value" # NoMethodError: undefined method `precs' for 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593014782083152134043
|
225
|
+
fails "Kernel#BigDecimal does not call to_s when calling inspect" # Expected "44.44" == "0.4444e2" to be truthy but was false
|
226
|
+
fails "Kernel#BigDecimal does not ignores trailing garbage" # Expected ArgumentError but got: Exception (new BigNumber() not a number: 123E45ruby)
|
227
|
+
fails "Kernel#BigDecimal ignores leading whitespace" # Exception: self.$BigDecimal(...).$should is not a function
|
228
|
+
fails "Kernel#BigDecimal ignores trailing garbage" # Exception: new BigNumber() not a number: 123E45ruby
|
229
|
+
fails "Kernel#BigDecimal pre-coerces long integers" # Expected 262000 == 1130000000000000 to be truthy but was false
|
230
|
+
fails "Kernel#BigDecimal process underscores as Float()" # Exception: new BigNumber() not a number: 12_345.67E89
|
231
|
+
fails "Kernel#BigDecimal raises ArgumentError for invalid strings" # Exception: new BigNumber() not a number: ruby
|
232
|
+
fails "Kernel#BigDecimal raises ArgumentError when Float is used without precision" # Expected ArgumentError but no exception was raised (1 was returned)
|
233
|
+
fails "Kernel#BigDecimal when interacting with Rational BigDecimal maximum precision is nine more than precision except for abnormals" # TypeError: Rational can't be coerced into BigDecimal
|
234
|
+
fails "Kernel#BigDecimal when interacting with Rational BigDecimal precision is the number of digits rounded up to a multiple of nine" # TypeError: Rational can't be coerced into BigDecimal
|
235
|
+
fails "Kernel#BigDecimal when interacting with Rational BigDecimal(Rational, 18) produces the result we expect" # TypeError: Rational can't be coerced into BigDecimal
|
236
|
+
fails "Kernel#BigDecimal when interacting with Rational BigDecimal(Rational, BigDecimal.precs[0]) produces the result we expect" # TypeError: Rational can't be coerced into BigDecimal
|
237
|
+
fails "Kernel#BigDecimal when interacting with Rational has the LHS print as expected" # TypeError: Rational can't be coerced into BigDecimal
|
238
|
+
fails "Kernel#BigDecimal when interacting with Rational has the RHS print as expected" # TypeError: Rational can't be coerced into BigDecimal
|
239
|
+
fails "Kernel#BigDecimal when interacting with Rational has the expected maximum precision on the LHS" # TypeError: Rational can't be coerced into BigDecimal
|
240
|
+
fails "Kernel#BigDecimal when interacting with Rational has the expected precision on the LHS" # TypeError: Rational can't be coerced into BigDecimal
|
241
|
+
fails "Kernel#BigDecimal when interacting with Rational produces a BigDecimal" # TypeError: Rational can't be coerced into BigDecimal
|
242
|
+
fails "Kernel#BigDecimal when interacting with Rational produces the correct class for other arithmetic operators" # TypeError: Rational can't be coerced into BigDecimal
|
243
|
+
fails "Kernel#BigDecimal when interacting with Rational produces the expected result when done via Float" # TypeError: Rational can't be coerced into BigDecimal
|
244
|
+
fails "Kernel#BigDecimal when interacting with Rational produces the expected result when done via to_f" # TypeError: Rational can't be coerced into BigDecimal
|
245
|
+
fails "Kernel#BigDecimal when interacting with Rational produces the expected result" # TypeError: Rational can't be coerced into BigDecimal
|
246
|
+
fails "Kernel#BigDecimal with exception: false returns nil for invalid strings" # Exception: new BigNumber() not a number: invalid
|
247
|
+
fails "Kernel#Pathname is a private instance method" # Expected Kernel to have private instance method 'Pathname' but it does not
|
248
|
+
end
|