opal 0.10.0 → 0.11.0.rc1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.codeclimate.yml +19 -0
- data/.gitmodules +1 -1
- data/.jshintrc +1 -2
- data/.rspec +1 -2
- data/.travis.yml +28 -18
- data/.yardopts +3 -1
- data/CHANGELOG.md +139 -1
- data/Gemfile +16 -9
- data/HACKING.md +2 -0
- data/README.md +7 -6
- data/Rakefile +1 -1
- data/appveyor.yml +30 -0
- data/benchmark/bm_constant_lookup_big.rb +799 -0
- data/benchmark/bm_constant_lookup_small.rb +59 -0
- data/benchmark/bm_module_definition_big.rb +400 -0
- data/benchmark/bm_module_definition_small.rb +30 -0
- data/benchmark-ips/bm_case.rb +33 -0
- data/benchmark-ips/bm_constants_lookup.rb +13 -0
- data/benchmark-ips/bm_is_number.rb +29 -0
- data/benchmark-ips/bm_symbol_to_proc.rb +19 -0
- data/bin/opal +4 -2
- data/bin/opal-repl +23 -1
- data/docs/compiled_ruby.md +16 -14
- data/docs/faq.md +3 -3
- data/docs/rspec.md +2 -1
- data/docs/unsupported_features.md +6 -4
- data/examples/rack/Gemfile +1 -0
- data/examples/rack/Gemfile.lock +11 -7
- data/examples/rack/app/application.rb +14 -3
- data/examples/rack/app/user.rb +2 -0
- data/examples/rack/config.ru +1 -1
- data/examples/rack/index.html.erb +1 -0
- data/examples/sinatra/Gemfile +1 -1
- data/examples/sinatra/Gemfile.lock +8 -11
- data/examples/sinatra/app/application.rb +2 -0
- data/lib/opal/ast/builder.rb +17 -0
- data/lib/opal/ast/node.rb +30 -0
- data/lib/opal/builder.rb +14 -3
- data/lib/opal/builder_processors.rb +1 -0
- data/lib/opal/cli.rb +45 -59
- data/lib/opal/cli_options.rb +18 -11
- data/lib/opal/cli_runners/applescript.rb +3 -3
- data/lib/opal/cli_runners/nashorn.rb +1 -0
- data/lib/opal/cli_runners/nodejs.rb +4 -1
- data/lib/opal/cli_runners/phantom.js +1 -2
- data/lib/opal/cli_runners/phantomjs.rb +3 -2
- data/lib/opal/cli_runners/server.rb +1 -0
- data/lib/opal/cli_runners.rb +1 -0
- data/lib/opal/compiler.rb +145 -94
- data/lib/opal/config.rb +114 -36
- data/lib/opal/deprecations.rb +18 -0
- data/lib/opal/erb.rb +1 -0
- data/lib/opal/errors.rb +1 -0
- data/lib/opal/fragment.rb +1 -0
- data/lib/opal/hike_path_finder.rb +1 -0
- data/lib/opal/nodes/arglist.rb +2 -1
- data/lib/opal/nodes/args/initialize_kwargs.rb +1 -0
- data/lib/opal/nodes/args/kwarg.rb +7 -7
- data/lib/opal/nodes/args/kwoptarg.rb +6 -7
- data/lib/opal/nodes/args/kwrestarg.rb +5 -5
- data/lib/opal/nodes/args/mlhsarg.rb +3 -2
- data/lib/opal/nodes/args/normarg.rb +6 -7
- data/lib/opal/nodes/args/optarg.rb +5 -7
- data/lib/opal/nodes/args/post_args.rb +6 -5
- data/lib/opal/nodes/args/post_kwargs.rb +1 -0
- data/lib/opal/nodes/args/restarg.rb +7 -7
- data/lib/opal/nodes/array.rb +1 -0
- data/lib/opal/nodes/base.rb +24 -3
- data/lib/opal/nodes/call.rb +167 -155
- data/lib/opal/nodes/call_special.rb +31 -217
- data/lib/opal/nodes/case.rb +36 -22
- data/lib/opal/nodes/class.rb +4 -3
- data/lib/opal/nodes/constants.rb +28 -48
- data/lib/opal/nodes/csend.rb +25 -0
- data/lib/opal/nodes/def.rb +57 -17
- data/lib/opal/nodes/defined.rb +170 -60
- data/lib/opal/nodes/definitions.rb +40 -133
- data/lib/opal/nodes/defs.rb +29 -0
- data/lib/opal/nodes/for.rb +52 -25
- data/lib/opal/nodes/hash.rb +12 -35
- data/lib/opal/nodes/helpers.rb +27 -54
- data/lib/opal/nodes/if.rb +21 -32
- data/lib/opal/nodes/inline_args.rb +12 -13
- data/lib/opal/nodes/iter.rb +61 -36
- data/lib/opal/nodes/literal.rb +194 -114
- data/lib/opal/nodes/logic.rb +20 -25
- data/lib/opal/nodes/masgn.rb +20 -18
- data/lib/opal/nodes/module.rb +10 -11
- data/lib/opal/nodes/node_with_args.rb +14 -17
- data/lib/opal/nodes/rescue.rb +37 -70
- data/lib/opal/nodes/runtime_helpers.rb +8 -3
- data/lib/opal/nodes/scope.rb +9 -5
- data/lib/opal/nodes/singleton_class.rb +4 -3
- data/lib/opal/nodes/super.rb +115 -87
- data/lib/opal/nodes/top.rb +7 -2
- data/lib/opal/nodes/variables.rb +46 -35
- data/lib/opal/nodes/while.rb +11 -1
- data/lib/opal/nodes/yield.rb +1 -17
- data/lib/opal/nodes.rb +3 -0
- data/lib/opal/parser.rb +28 -770
- data/lib/opal/path_reader.rb +5 -1
- data/lib/opal/paths.rb +10 -4
- data/lib/opal/regexp_anchors.rb +1 -0
- data/lib/opal/rewriter.rb +60 -0
- data/lib/opal/rewriters/base.rb +60 -0
- data/lib/opal/rewriters/binary_operator_assignment.rb +144 -0
- data/lib/opal/rewriters/block_to_iter.rb +17 -0
- data/lib/opal/rewriters/break_finder.rb +34 -0
- data/lib/opal/rewriters/dot_js_syntax.rb +60 -0
- data/lib/opal/rewriters/explicit_writer_return.rb +58 -0
- data/lib/opal/rewriters/js_reserved_words.rb +111 -0
- data/lib/opal/rewriters/logical_operator_assignment.rb +155 -0
- data/lib/opal/rewriters/opal_engine_check.rb +42 -0
- data/lib/opal/rewriters/rubyspec/filters_rewriter.rb +67 -0
- data/lib/opal/server.rb +4 -0
- data/lib/opal/simple_server.rb +100 -0
- data/lib/opal/source_map.rb +1 -1
- data/lib/opal/util.rb +5 -5
- data/lib/opal/version.rb +2 -1
- data/lib/opal.rb +6 -1
- data/lib/tilt/opal.rb +1 -0
- data/opal/README.md +1 -1
- data/opal/corelib/array.rb +137 -83
- data/opal/corelib/basic_object.rb +6 -6
- data/opal/corelib/class.rb +14 -11
- data/opal/corelib/complex.rb +5 -1
- data/opal/corelib/constants.rb +3 -3
- data/opal/corelib/enumerable.rb +129 -11
- data/opal/corelib/error.rb +35 -17
- data/opal/corelib/file.rb +65 -170
- data/opal/corelib/hash.rb +128 -13
- data/opal/corelib/helpers.rb +12 -15
- data/opal/corelib/io.rb +1 -0
- data/opal/corelib/kernel.rb +40 -21
- data/opal/corelib/marshal/read_buffer.rb +1 -1
- data/opal/corelib/method.rb +33 -13
- data/opal/corelib/module.rb +134 -82
- data/opal/corelib/number.rb +141 -25
- data/opal/corelib/numeric.rb +0 -8
- data/opal/corelib/process.rb +44 -4
- data/opal/corelib/random/seedrandom.js.rb +15 -0
- data/opal/corelib/random.rb +117 -0
- data/opal/corelib/range.rb +133 -10
- data/opal/corelib/regexp.rb +37 -9
- data/opal/corelib/runtime.js +604 -394
- data/opal/corelib/string/encoding.rb +51 -7
- data/opal/corelib/string.rb +39 -8
- data/opal/corelib/struct.rb +20 -0
- data/opal/corelib/time.rb +2 -2
- data/opal/corelib/variables.rb +1 -1
- data/opal/opal.rb +1 -0
- data/opal.gemspec +9 -8
- data/spec/filters/bugs/array.rb +5 -1
- data/spec/filters/bugs/basicobject.rb +2 -5
- data/spec/filters/bugs/bigdecimal.rb +8 -22
- data/spec/filters/bugs/class.rb +2 -1
- data/spec/filters/bugs/comparable.rb +5 -0
- data/spec/filters/bugs/date.rb +3 -3
- data/spec/filters/bugs/enumerable.rb +4 -11
- data/spec/filters/bugs/enumerator.rb +2 -4
- data/spec/filters/bugs/exception.rb +16 -2
- data/spec/filters/bugs/file.rb +8 -0
- data/spec/filters/bugs/float.rb +7 -1
- data/spec/filters/bugs/hash.rb +6 -2
- data/spec/filters/bugs/integer.rb +2 -0
- data/spec/filters/bugs/io.rb +8 -0
- data/spec/filters/bugs/kernel.rb +9 -138
- data/spec/filters/bugs/language.rb +89 -174
- data/spec/filters/bugs/marshal.rb +33 -35
- data/spec/filters/bugs/method.rb +0 -24
- data/spec/filters/bugs/module.rb +19 -57
- data/spec/filters/bugs/numeric.rb +0 -119
- data/spec/filters/bugs/pathname.rb +2 -0
- data/spec/filters/bugs/proc.rb +5 -4
- data/spec/filters/bugs/random.rb +7 -0
- data/spec/filters/bugs/range.rb +12 -120
- data/spec/filters/bugs/rational.rb +1 -1
- data/spec/filters/bugs/regexp.rb +2 -40
- data/spec/filters/bugs/set.rb +0 -1
- data/spec/filters/bugs/string.rb +5 -8
- data/spec/filters/bugs/stringscanner.rb +11 -19
- data/spec/filters/bugs/time.rb +7 -1
- data/spec/filters/bugs/unboundmethod.rb +1 -11
- data/spec/filters/unsupported/array.rb +5 -1
- data/spec/filters/unsupported/basicobject.rb +1 -1
- data/spec/filters/unsupported/bignum.rb +4 -1
- data/spec/filters/unsupported/class.rb +1 -1
- data/spec/filters/unsupported/delegator.rb +1 -1
- data/spec/filters/unsupported/enumerable.rb +1 -1
- data/spec/filters/unsupported/enumerator.rb +1 -1
- data/spec/filters/unsupported/file.rb +4 -0
- data/spec/filters/unsupported/fixnum.rb +1 -1
- data/spec/filters/unsupported/float.rb +4 -1
- data/spec/filters/unsupported/freeze.rb +27 -5
- data/spec/filters/unsupported/hash.rb +7 -15
- data/spec/filters/unsupported/integer.rb +1 -1
- data/spec/filters/unsupported/kernel.rb +2 -1
- data/spec/filters/unsupported/language.rb +6 -1
- data/spec/filters/unsupported/marshal.rb +1 -1
- data/spec/filters/unsupported/matchdata.rb +4 -1
- data/spec/filters/unsupported/math.rb +1 -1
- data/spec/filters/unsupported/pathname.rb +1 -1
- data/spec/filters/unsupported/privacy.rb +141 -9
- data/spec/filters/unsupported/proc.rb +1 -1
- data/spec/filters/unsupported/random.rb +4 -0
- data/spec/filters/unsupported/range.rb +7 -0
- data/spec/filters/unsupported/regexp.rb +25 -15
- data/spec/filters/unsupported/set.rb +1 -1
- data/spec/filters/unsupported/singleton.rb +1 -1
- data/spec/filters/unsupported/string.rb +110 -101
- data/spec/filters/unsupported/struct.rb +1 -1
- data/spec/filters/unsupported/symbol.rb +2 -1
- data/spec/filters/unsupported/taint.rb +22 -7
- data/spec/filters/unsupported/thread.rb +1 -1
- data/spec/filters/unsupported/time.rb +1 -1
- data/spec/lib/builder_spec.rb +17 -0
- data/spec/lib/cli_runners/phantomjs_spec.rb +2 -2
- data/spec/lib/cli_spec.rb +37 -8
- data/spec/lib/compiler/call_spec.rb +98 -66
- data/spec/lib/compiler_spec.rb +41 -32
- data/spec/lib/config_spec.rb +97 -0
- data/spec/lib/dependency_resolver_spec.rb +2 -2
- data/spec/lib/deprecations_spec.rb +16 -0
- data/spec/lib/fixtures/source_location_test.rb +7 -0
- data/spec/lib/path_reader_spec.rb +3 -3
- data/spec/lib/rewriters/binary_operator_assignment_spec.rb +151 -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/js_reserved_words_spec.rb +116 -0
- data/spec/lib/rewriters/logical_operator_assignment_spec.rb +202 -0
- data/spec/lib/rewriters/opal_engine_check_spec.rb +82 -0
- data/spec/lib/rewriters/rubyspec/filters_rewriter_spec.rb +53 -0
- data/spec/lib/simple_server_spec.rb +54 -0
- data/spec/lib/spec_helper.rb +88 -4
- data/spec/mspec-opal/formatters.rb +65 -17
- data/spec/mspec-opal/runner.rb +47 -67
- data/spec/opal/core/date_spec.rb +14 -0
- data/spec/opal/core/exception_spec.rb +10 -0
- data/spec/opal/core/hash/internals_spec.rb +10 -10
- data/spec/opal/core/kernel/rand_spec.rb +0 -4
- data/spec/opal/core/kernel/respond_to_spec.rb +5 -2
- data/spec/opal/core/language/constant_lookup_spec.rb +38 -0
- data/spec/opal/core/language/safe_navigator_spec.rb +7 -0
- data/spec/opal/core/language/send_spec.rb +1 -9
- data/spec/opal/core/language/string_spec.rb +8 -8
- data/spec/opal/core/language/versions/def_2_0_spec.rb +0 -4
- data/spec/opal/core/language_spec.rb +32 -0
- data/spec/opal/core/module/const_get_spec.rb +1 -1
- data/spec/opal/core/runtime/is_a_spec.rb +36 -0
- data/spec/opal/core/runtime/rescue_spec.rb +35 -0
- data/spec/opal/core/runtime_spec.rb +4 -4
- data/spec/opal/core/string_spec.rb +8 -8
- data/spec/opal/core/time_spec.rb +38 -0
- data/spec/opal/stdlib/erb/quoted.opalerb +1 -1
- data/spec/opal/stdlib/json/parse_spec.rb +4 -0
- data/spec/opal/stdlib/native/hash_spec.rb +16 -0
- data/spec/ruby_specs +2 -1
- data/spec/spec_helper.rb +1 -0
- data/spec/support/rewriters_helper.rb +24 -0
- data/stdlib/base64.rb +4 -2
- data/stdlib/bigdecimal/bignumber.js.rb +1 -1
- data/stdlib/date.rb +18 -19
- data/stdlib/json.rb +16 -4
- data/stdlib/nashorn/file.rb +15 -0
- data/stdlib/native.rb +21 -12
- data/stdlib/nodejs/dir.rb +1 -1
- data/stdlib/nodejs/file.rb +49 -20
- data/stdlib/nodejs/io.rb +22 -1
- data/stdlib/nodejs/{node_modules/js-yaml/dist/js-yaml.js → js-yaml-3-6-1.js} +815 -626
- data/stdlib/nodejs/kernel.rb +3 -1
- data/stdlib/nodejs/package.json +0 -1
- data/stdlib/nodejs/stacktrace.rb +163 -0
- data/stdlib/nodejs/yaml.rb +2 -1
- data/stdlib/opal/platform.rb +5 -13
- data/stdlib/opal-platform.rb +15 -0
- data/stdlib/pathname.rb +1 -1
- data/stdlib/strscan.rb +15 -1
- data/stdlib/yaml.rb +1 -1
- data/tasks/benchmarking.rake +9 -0
- data/tasks/building.rake +24 -20
- data/tasks/linting.rake +24 -13
- data/tasks/testing/mspec_special_calls.rb +44 -15
- data/tasks/testing/opal_rspec_smoketest.Gemfile +13 -0
- data/tasks/testing.rake +322 -205
- data/test/nodejs/fixtures/hello.rb +1 -0
- data/test/nodejs/test_file.rb +57 -0
- data/test/nodejs/test_io.rb +18 -0
- data/test/nodejs/test_opal_builder.rb +12 -0
- data/test/opal/unsupported_and_bugs.rb +9 -0
- metadata +131 -242
- data/lib/opal/parser/grammar.rb +0 -6157
- data/lib/opal/parser/grammar.y +0 -2011
- data/lib/opal/parser/keywords.rb +0 -66
- data/lib/opal/parser/lexer.rb +0 -1352
- data/lib/opal/parser/parser_scope.rb +0 -28
- data/lib/opal/parser/sexp.rb +0 -90
- data/lib/opal/sprockets/environment.rb +0 -23
- data/lib/opal/sprockets/erb.rb +0 -23
- data/lib/opal/sprockets/path_reader.rb +0 -36
- data/lib/opal/sprockets/processor.rb +0 -145
- data/lib/opal/sprockets/server.rb +0 -133
- data/lib/opal/sprockets/source_map_header_patch.rb +0 -41
- data/lib/opal/sprockets/source_map_server.rb +0 -115
- data/lib/opal/sprockets.rb +0 -91
- data/spec/filters/bugs/compiler_opal.rb +0 -5
- data/spec/filters/bugs/language_opal.rb +0 -88
- data/spec/filters/unsupported/module.rb +0 -8
- data/spec/lib/compiler/pre_processed_conditionals_spec.rb +0 -87
- data/spec/lib/lexer_spec.rb +0 -110
- data/spec/lib/parser/alias_spec.rb +0 -26
- data/spec/lib/parser/and_spec.rb +0 -13
- data/spec/lib/parser/aref_spec.rb +0 -10
- data/spec/lib/parser/attrasgn_spec.rb +0 -28
- data/spec/lib/parser/begin_spec.rb +0 -42
- data/spec/lib/parser/block_spec.rb +0 -12
- data/spec/lib/parser/break_spec.rb +0 -17
- data/spec/lib/parser/call_spec.rb +0 -201
- data/spec/lib/parser/class_spec.rb +0 -35
- data/spec/lib/parser/comments_spec.rb +0 -11
- data/spec/lib/parser/def_spec.rb +0 -109
- data/spec/lib/parser/if_spec.rb +0 -26
- data/spec/lib/parser/iter_spec.rb +0 -59
- data/spec/lib/parser/lambda_spec.rb +0 -219
- data/spec/lib/parser/literal_spec.rb +0 -118
- data/spec/lib/parser/masgn_spec.rb +0 -37
- data/spec/lib/parser/module_spec.rb +0 -27
- data/spec/lib/parser/not_spec.rb +0 -21
- data/spec/lib/parser/op_asgn1_spec.rb +0 -23
- data/spec/lib/parser/op_asgn2_spec.rb +0 -23
- data/spec/lib/parser/op_asgn_spec.rb +0 -17
- data/spec/lib/parser/or_spec.rb +0 -13
- data/spec/lib/parser/return_spec.rb +0 -22
- data/spec/lib/parser/sclass_spec.rb +0 -21
- data/spec/lib/parser/string_spec.rb +0 -286
- data/spec/lib/parser/super_spec.rb +0 -20
- data/spec/lib/parser/unary_spec.rb +0 -52
- data/spec/lib/parser/undef_spec.rb +0 -19
- data/spec/lib/parser/unless_spec.rb +0 -13
- data/spec/lib/parser/variables_spec.rb +0 -116
- data/spec/lib/parser/while_spec.rb +0 -15
- data/spec/lib/parser/yield_spec.rb +0 -20
- data/spec/lib/sprockets/erb_spec.rb +0 -38
- data/spec/lib/sprockets/path_reader_spec.rb +0 -41
- data/spec/lib/sprockets/processor_spec.rb +0 -79
- data/spec/lib/sprockets/server_spec.rb +0 -102
- data/spec/lib/sprockets_spec.rb +0 -32
- data/spec/lib/tilt/opal_spec.rb +0 -37
- data/spec/opal/core/language/block_spec.rb +0 -538
- data/spec/opal/core/language/proc_spec.rb +0 -263
- data/spec/opal/core/language/variables_spec.rb +0 -1366
- data/spec/opal/core/runtime/block_send_spec.rb +0 -28
- data/spec/opal/core/runtime/send_spec.rb +0 -34
- data/spec/support/parser_helpers.rb +0 -37
- data/stdlib/nodejs/node_modules/js-yaml/HISTORY.md +0 -277
- data/stdlib/nodejs/node_modules/js-yaml/LICENSE +0 -21
- data/stdlib/nodejs/node_modules/js-yaml/README.md +0 -288
- data/stdlib/nodejs/node_modules/js-yaml/bin/js-yaml.js +0 -140
- data/stdlib/nodejs/node_modules/js-yaml/bower.json +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/dist/js-yaml.min.js +0 -3
- data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.js +0 -102
- data/stdlib/nodejs/node_modules/js-yaml/examples/custom_types.yml +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.js +0 -31
- data/stdlib/nodejs/node_modules/js-yaml/examples/dumper.json +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/examples/sample_document.yml +0 -197
- data/stdlib/nodejs/node_modules/js-yaml/index.js +0 -7
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/common.js +0 -62
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/dumper.js +0 -554
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/exception.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/loader.js +0 -1581
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/mark.js +0 -78
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/core.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_full.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js +0 -28
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js +0 -17
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema/json.js +0 -25
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/schema.js +0 -103
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/binary.js +0 -133
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/bool.js +0 -37
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/float.js +0 -110
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/int.js +0 -183
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/function.js +0 -85
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js +0 -84
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js +0 -27
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/map.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/merge.js +0 -12
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/null.js +0 -36
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/omap.js +0 -56
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/pairs.js +0 -61
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/seq.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/set.js +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/str.js +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type/timestamp.js +0 -98
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml/type.js +0 -61
- data/stdlib/nodejs/node_modules/js-yaml/lib/js-yaml.js +0 -39
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/HISTORY.md +0 -115
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/LICENSE +0 -21
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/README.md +0 -239
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/arguments.js +0 -36
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/choice.js +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/constants.js +0 -59
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/help.js +0 -13
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/nargs.js +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/parents.js +0 -28
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/prefix_chars.js +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sub_commands.js +0 -49
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/sum.js +0 -35
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/examples/testformatters.js +0 -270
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/index.js +0 -1
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append/constant.js +0 -47
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/append.js +0 -55
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/count.js +0 -40
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/help.js +0 -48
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/constant.js +0 -43
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/false.js +0 -27
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store/true.js +0 -26
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/store.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/subparsers.js +0 -148
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action/version.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action.js +0 -146
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/action_container.js +0 -481
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argparse.js +0 -14
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/error.js +0 -50
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/exclusive.js +0 -54
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument/group.js +0 -75
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/argument_parser.js +0 -1168
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/const.js +0 -18
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/added_formatters.js +0 -88
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/help/formatter.js +0 -798
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/lib/namespace.js +0 -77
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/LICENSE +0 -23
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/README.md +0 -22
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/package.json +0 -69
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore-min.js +0 -6
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore/underscore.js +0 -1415
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.npmignore +0 -2
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/.travis.yml +0 -8
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/README.markdown +0 -825
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/bower.json +0 -33
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/component.json +0 -11
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/foo.js +0 -10
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/gulpfile.js +0 -26
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/lib/underscore.string.js +0 -673
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/libpeerconnection.log +0 -0
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/node_modules/underscore.string/package.json +0 -107
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/argparse/package.json +0 -62
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/README.md +0 -73
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esparse.js +0 -117
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/bin/esvalidate.js +0 -177
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/esprima.js +0 -3908
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/package.json +0 -69
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/compat.js +0 -239
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/reflect.js +0 -422
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/run.js +0 -66
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/runner.js +0 -387
- data/stdlib/nodejs/node_modules/js-yaml/node_modules/esprima/test/test.js +0 -20238
- data/stdlib/nodejs/node_modules/js-yaml/package.json +0 -83
- /data/{CODE_OF_CONDUCT.md → CONDUCT.md} +0 -0
|
@@ -1,5 +1,18 @@
|
|
|
1
|
-
|
|
1
|
+
opal_unsupported_filter "String" do
|
|
2
2
|
fails "BasicObject#__id__ returns a different value for two String literals"
|
|
3
|
+
fails "Ruby character strings Unicode escaping can be done with \\u{} and one to six hex digits"
|
|
4
|
+
fails "Ruby character strings Unicode escaping with ASCII_8BIT source encoding produces a UTF-8-encoded string when escaping non-ASCII characters via \\u" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:UTF-8>
|
|
5
|
+
fails "Ruby character strings Unicode escaping with ASCII_8BIT source encoding produces a UTF-8-encoded string when escaping non-ASCII characters via \\u{}" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:UTF-8>
|
|
6
|
+
fails "Ruby character strings Unicode escaping with ASCII_8BIT source encoding produces an ASCII string when escaping ASCII characters via \\u" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT>
|
|
7
|
+
fails "Ruby character strings Unicode escaping with ASCII_8BIT source encoding produces an ASCII string when escaping ASCII characters via \\u{}" # Expected #<Encoding:UTF-16LE> to equal #<Encoding:ASCII-8BIT>
|
|
8
|
+
fails "Ruby character strings Unicode escaping with US-ASCII source encoding produces a UTF-8-encoded string when escaping non-ASCII characters via \\u"
|
|
9
|
+
fails "Ruby character strings Unicode escaping with US-ASCII source encoding produces a UTF-8-encoded string when escaping non-ASCII characters via \\u{}"
|
|
10
|
+
fails "Ruby character strings Unicode escaping with US-ASCII source encoding produces an ASCII string when escaping ASCII characters via \\u"
|
|
11
|
+
fails "Ruby character strings Unicode escaping with US-ASCII source encoding produces an ASCII string when escaping ASCII characters via \\u{}"
|
|
12
|
+
fails "Ruby character strings are produced from control character shortcuts"
|
|
13
|
+
fails "Ruby character strings backslashes follow the same rules as interpolation"
|
|
14
|
+
fails "Ruby character strings taints the result of interpolation when an interpolated value is tainted"
|
|
15
|
+
fails "Ruby character strings untrusts the result of interpolation when an interpolated value is untrusted"
|
|
3
16
|
fails "String#% always taints the result when the format string is tainted"
|
|
4
17
|
fails "String#% supports negative bignums with %u or %d"
|
|
5
18
|
fails "String#% taints result for %p when argument.inspect is tainted"
|
|
@@ -42,9 +55,9 @@ opal_filter "String" do
|
|
|
42
55
|
fails "String#<< when the argument is in an ASCII-incompatible encoding incompatible with self's encoding uses the argument's encoding if self is empty"
|
|
43
56
|
fails "String#<< with Integer concatencates the argument interpreted as a codepoint"
|
|
44
57
|
fails "String#<< with Integer doesn't call to_int on its argument"
|
|
45
|
-
fails "String#<< with Integer raises a RuntimeError when self is frozen"
|
|
46
58
|
fails "String#<< with Integer raises RangeError if the argument is an invalid codepoint for self's encoding"
|
|
47
59
|
fails "String#<< with Integer raises RangeError if the argument is negative"
|
|
60
|
+
fails "String#<< with Integer raises a RuntimeError when self is frozen"
|
|
48
61
|
fails "String#<< with Integer returns a ASCII-8BIT string if self is US-ASCII and the argument is between 128-255 (inclusive)"
|
|
49
62
|
fails "String#<=> with String compares the indices of the encodings when the strings have identical non-ASCII-compatible bytes"
|
|
50
63
|
fails "String#<=> with String ignores encoding difference"
|
|
@@ -57,6 +70,62 @@ opal_filter "String" do
|
|
|
57
70
|
fails "String#=== considers encoding compatibility"
|
|
58
71
|
fails "String#=== considers encoding difference of incompatible string"
|
|
59
72
|
fails "String#=== ignores encoding difference of compatible string"
|
|
73
|
+
fails "String#[] with Range always taints resulting strings when self is tainted"
|
|
74
|
+
fails "String#[] with Regexp, index always taints resulting strings when self or regexp is tainted"
|
|
75
|
+
fails "String#[] with String taints resulting strings when other is tainted"
|
|
76
|
+
fails "String#[] with Symbol raises TypeError"
|
|
77
|
+
fails "String#[] with index, length always taints resulting strings when self is tainted"
|
|
78
|
+
fails "String#[]= with Fixnum index allows assignment to the zero'th element of an empty String"
|
|
79
|
+
fails "String#[]= with Fixnum index calls #to_str to convert other to a String"
|
|
80
|
+
fails "String#[]= with Fixnum index calls to_int on index"
|
|
81
|
+
fails "String#[]= with Fixnum index raises IndexError if the string index doesn't match a position in the string"
|
|
82
|
+
fails "String#[]= with Fixnum index raises a RuntimeError when self is frozen"
|
|
83
|
+
fails "String#[]= with Fixnum index raises a TypeError if other_str can't be converted to a String"
|
|
84
|
+
fails "String#[]= with Fixnum index raises an IndexError without changing self if idx is outside of self"
|
|
85
|
+
fails "String#[]= with Fixnum index replaces the char at idx with other_str"
|
|
86
|
+
fails "String#[]= with Fixnum index taints self if other_str is tainted"
|
|
87
|
+
fails "String#[]= with Fixnum index, count appends other_str to the end of the string if idx == the length of the string"
|
|
88
|
+
fails "String#[]= with Fixnum index, count calls #to_int to convert the index and count objects"
|
|
89
|
+
fails "String#[]= with Fixnum index, count calls #to_str to convert the replacement object"
|
|
90
|
+
fails "String#[]= with Fixnum index, count counts negative idx values from end of the string"
|
|
91
|
+
fails "String#[]= with Fixnum index, count deletes characters if other_str is an empty string"
|
|
92
|
+
fails "String#[]= with Fixnum index, count deletes characters up to the maximum length of the existing string"
|
|
93
|
+
fails "String#[]= with Fixnum index, count overwrites and deletes characters if count is more than the length of other_str"
|
|
94
|
+
fails "String#[]= with Fixnum index, count raises a TypeError if #to_int for count does not return an Integer"
|
|
95
|
+
fails "String#[]= with Fixnum index, count raises a TypeError if #to_int for index does not return an Integer"
|
|
96
|
+
fails "String#[]= with Fixnum index, count raises a TypeError if other_str is a type other than String"
|
|
97
|
+
fails "String#[]= with Fixnum index, count raises a TypeError of #to_str does not return a String"
|
|
98
|
+
fails "String#[]= with Fixnum index, count raises an IndexError if count < 0"
|
|
99
|
+
fails "String#[]= with Fixnum index, count raises an IndexError if |idx| is greater than the length of the string"
|
|
100
|
+
fails "String#[]= with Fixnum index, count starts at idx and overwrites count characters before inserting the rest of other_str"
|
|
101
|
+
fails "String#[]= with Fixnum index, count taints self if other_str is tainted"
|
|
102
|
+
fails "String#[]= with String index raises an IndexError if the search String is not found"
|
|
103
|
+
fails "String#[]= with String index replaces characters with no characters"
|
|
104
|
+
fails "String#[]= with String index replaces fewer characters with more characters"
|
|
105
|
+
fails "String#[]= with String index replaces more characters with fewer characters"
|
|
106
|
+
fails "String#[]= with a Range index raises a RangeError if negative Range begin is out of range"
|
|
107
|
+
fails "String#[]= with a Range index raises a RangeError if positive Range begin is greater than String size"
|
|
108
|
+
fails "String#[]= with a Range index replaces a partial string"
|
|
109
|
+
fails "String#[]= with a Range index replaces the contents with a longer String"
|
|
110
|
+
fails "String#[]= with a Range index replaces the contents with a shorter String"
|
|
111
|
+
fails "String#[]= with a Range index treats a negative out-of-range Range end with a negative Range begin as a zero count"
|
|
112
|
+
fails "String#[]= with a Range index treats a negative out-of-range Range end with a positive Range begin as a zero count"
|
|
113
|
+
fails "String#[]= with a Range index uses the Range end as an index rather than a count"
|
|
114
|
+
fails "String#[]= with a Range index with an empty replacement does not replace a character with a zero exclude-end range"
|
|
115
|
+
fails "String#[]= with a Range index with an empty replacement does not replace a character with a zero-index, zero exclude-end range"
|
|
116
|
+
fails "String#[]= with a Range index with an empty replacement replaces a character with a zero non-exclude-end range"
|
|
117
|
+
fails "String#[]= with a Range index with an empty replacement replaces a character with zero-index, zero non-exclude-end range"
|
|
118
|
+
fails "String#[]= with a Regexp index calls #to_str to convert the replacement"
|
|
119
|
+
fails "String#[]= with a Regexp index checks the match before calling #to_str to convert the replacement"
|
|
120
|
+
fails "String#[]= with a Regexp index raises IndexError if the regexp index doesn't match a position in the string"
|
|
121
|
+
fails "String#[]= with a Regexp index replaces the matched text with the rhs"
|
|
122
|
+
fails "String#[]= with a Regexp index with 3 arguments allows the specified capture to be negative and count from the end"
|
|
123
|
+
fails "String#[]= with a Regexp index with 3 arguments calls #to_int to convert the second object"
|
|
124
|
+
fails "String#[]= with a Regexp index with 3 arguments checks the match index before calling #to_str to convert the replacement"
|
|
125
|
+
fails "String#[]= with a Regexp index with 3 arguments raises IndexError if the specified capture isn't available"
|
|
126
|
+
fails "String#[]= with a Regexp index with 3 arguments raises a TypeError if #to_int does not return a Fixnum"
|
|
127
|
+
fails "String#[]= with a Regexp index with 3 arguments uses the 2nd of 3 arguments as which capture should be replaced"
|
|
128
|
+
fails "String#[]= with a Regexp index with 3 arguments when the optional capture does not match raises an IndexError before setting the replacement"
|
|
60
129
|
fails "String#capitalize is locale insensitive (only upcases a-z and only downcases A-Z)"
|
|
61
130
|
fails "String#capitalize taints resulting string when self is tainted"
|
|
62
131
|
fails "String#capitalize! capitalizes self in place"
|
|
@@ -142,9 +211,9 @@ opal_filter "String" do
|
|
|
142
211
|
fails "String#concat when the argument is in an ASCII-incompatible encoding incompatible with self's encoding uses the argument's encoding if self is empty"
|
|
143
212
|
fails "String#concat with Integer concatencates the argument interpreted as a codepoint"
|
|
144
213
|
fails "String#concat with Integer doesn't call to_int on its argument"
|
|
145
|
-
fails "String#concat with Integer raises a RuntimeError when self is frozen"
|
|
146
214
|
fails "String#concat with Integer raises RangeError if the argument is an invalid codepoint for self's encoding"
|
|
147
215
|
fails "String#concat with Integer raises RangeError if the argument is negative"
|
|
216
|
+
fails "String#concat with Integer raises a RuntimeError when self is frozen"
|
|
148
217
|
fails "String#concat with Integer returns a ASCII-8BIT string if self is US-ASCII and the argument is between 128-255 (inclusive)"
|
|
149
218
|
fails "String#count returns the number of occurrences of a multi-byte character"
|
|
150
219
|
fails "String#delete taints result when self is tainted"
|
|
@@ -156,6 +225,7 @@ opal_filter "String" do
|
|
|
156
225
|
fails "String#downcase! modifies self in place"
|
|
157
226
|
fails "String#downcase! raises a RuntimeError when self is frozen"
|
|
158
227
|
fails "String#downcase! returns nil if no modifications were made"
|
|
228
|
+
fails "String#dump untrusts the result if self is untrusted"
|
|
159
229
|
fails "String#dup does not modify the original string when changing dupped string"
|
|
160
230
|
fails "String#each_char is unicode aware"
|
|
161
231
|
fails "String#each_line does not care if the string is modified while substituting"
|
|
@@ -164,29 +234,22 @@ opal_filter "String" do
|
|
|
164
234
|
fails "String#eql? considers encoding compatibility"
|
|
165
235
|
fails "String#eql? considers encoding difference of incompatible string"
|
|
166
236
|
fails "String#eql? ignores encoding difference of compatible string"
|
|
167
|
-
fails "String#gsub with pattern and block raises an Encoding::CompatibilityError if the encodings are not compatible"
|
|
168
|
-
fails "String#gsub with pattern and block replaces the incompatible part properly even if the encodings are not compatible"
|
|
169
|
-
fails "String#gsub with pattern and block untrusts the result if the original string or replacement is untrusted"
|
|
170
|
-
fails "String#gsub with pattern and block uses the compatible encoding if they are compatible"
|
|
171
237
|
fails "String#gsub with pattern and Hash ignores non-String keys"
|
|
172
238
|
fails "String#gsub with pattern and Hash taints the result if a hash value is tainted"
|
|
173
239
|
fails "String#gsub with pattern and Hash taints the result if the original string is tainted"
|
|
174
240
|
fails "String#gsub with pattern and Hash untrusts the result if a hash value is untrusted"
|
|
175
241
|
fails "String#gsub with pattern and Hash untrusts the result if the original string is untrusted"
|
|
242
|
+
fails "String#gsub with pattern and block raises an ArgumentError if encoding is not valid"
|
|
243
|
+
fails "String#gsub with pattern and block raises an Encoding::CompatibilityError if the encodings are not compatible"
|
|
244
|
+
fails "String#gsub with pattern and block replaces the incompatible part properly even if the encodings are not compatible"
|
|
245
|
+
fails "String#gsub with pattern and block untrusts the result if the original string or replacement is untrusted"
|
|
246
|
+
fails "String#gsub with pattern and block uses the compatible encoding if they are compatible"
|
|
176
247
|
fails "String#gsub with pattern and replacement doesn't freak out when replacing ^" #Only fails "Text\nFoo".gsub(/^/, ' ').should == " Text\n Foo"
|
|
177
248
|
fails "String#gsub with pattern and replacement replaces \\k named backreferences with the regexp's corresponding capture"
|
|
178
249
|
fails "String#gsub with pattern and replacement returns a copy of self with all occurrences of pattern replaced with replacement" #Only fails str.gsub(/\Ah\S+\s*/, "huh? ").should == "huh? homely world. hah!"
|
|
179
250
|
fails "String#gsub with pattern and replacement supports \\G which matches at the beginning of the remaining (non-matched) string"
|
|
180
251
|
fails "String#gsub with pattern and replacement taints the result if the original string or replacement is tainted"
|
|
181
252
|
fails "String#gsub with pattern and replacement untrusts the result if the original string or replacement is untrusted"
|
|
182
|
-
fails "String#gsub! with pattern and block modifies self in place and returns self"
|
|
183
|
-
fails "String#gsub! with pattern and block raises a RuntimeError when self is frozen"
|
|
184
|
-
fails "String#gsub! with pattern and block raises an Encoding::CompatibilityError if the encodings are not compatible"
|
|
185
|
-
fails "String#gsub! with pattern and block replaces the incompatible part properly even if the encodings are not compatible"
|
|
186
|
-
fails "String#gsub! with pattern and block returns nil if no modifications were made"
|
|
187
|
-
fails "String#gsub! with pattern and block taints self if block's result is tainted"
|
|
188
|
-
fails "String#gsub! with pattern and block untrusts self if block's result is untrusted"
|
|
189
|
-
fails "String#gsub! with pattern and block uses the compatible encoding if they are compatible"
|
|
190
253
|
fails "String#gsub! with pattern and Hash coerces the hash values with #to_s"
|
|
191
254
|
fails "String#gsub! with pattern and Hash doesn't interpolate special sequences like \\1 for the block's return value"
|
|
192
255
|
fails "String#gsub! with pattern and Hash ignores keys that don't correspond to matches"
|
|
@@ -201,12 +264,21 @@ opal_filter "String" do
|
|
|
201
264
|
fails "String#gsub! with pattern and Hash uses a key's value as many times as needed"
|
|
202
265
|
fails "String#gsub! with pattern and Hash uses the hash's default value for missing keys"
|
|
203
266
|
fails "String#gsub! with pattern and Hash uses the hash's value set from default_proc for missing keys"
|
|
267
|
+
fails "String#gsub! with pattern and block modifies self in place and returns self"
|
|
268
|
+
fails "String#gsub! with pattern and block raises a RuntimeError when self is frozen"
|
|
269
|
+
fails "String#gsub! with pattern and block raises an ArgumentError if encoding is not valid"
|
|
270
|
+
fails "String#gsub! with pattern and block raises an Encoding::CompatibilityError if the encodings are not compatible"
|
|
271
|
+
fails "String#gsub! with pattern and block replaces the incompatible part properly even if the encodings are not compatible"
|
|
272
|
+
fails "String#gsub! with pattern and block returns nil if no modifications were made"
|
|
273
|
+
fails "String#gsub! with pattern and block taints self if block's result is tainted"
|
|
274
|
+
fails "String#gsub! with pattern and block untrusts self if block's result is untrusted"
|
|
275
|
+
fails "String#gsub! with pattern and block uses the compatible encoding if they are compatible"
|
|
204
276
|
fails "String#gsub! with pattern and replacement modifies self in place and returns self"
|
|
277
|
+
fails "String#gsub! with pattern and replacement modifies self in place with multi-byte characters and returns self"
|
|
205
278
|
fails "String#gsub! with pattern and replacement raises a RuntimeError when self is frozen"
|
|
206
279
|
fails "String#gsub! with pattern and replacement returns nil if no modifications were made"
|
|
207
280
|
fails "String#gsub! with pattern and replacement taints self if replacement is tainted"
|
|
208
281
|
fails "String#gsub! with pattern and replacement untrusts self if replacement is untrusted"
|
|
209
|
-
fails "String#gsub! with pattern and replacement modifies self in place with multi-byte characters and returns self"
|
|
210
282
|
fails "String#gsub! with pattern and without replacement and block returned Enumerator size should return nil"
|
|
211
283
|
fails "String#gsub! with pattern and without replacement and block returns an enumerator"
|
|
212
284
|
fails "String#index raises a TypeError if passed a Symbol"
|
|
@@ -233,8 +305,8 @@ opal_filter "String" do
|
|
|
233
305
|
fails "String#insert with index, other raises a TypeError if other can't be converted to string"
|
|
234
306
|
fails "String#insert with index, other raises an IndexError if the index is beyond string"
|
|
235
307
|
fails "String#insert with index, other taints self if string to insert is tainted"
|
|
236
|
-
fails "String#inspect returns a string with non-printing characters replaced by \\x notation"
|
|
237
308
|
fails "String#inspect returns a string with a NUL character replaced by \\x notation"
|
|
309
|
+
fails "String#inspect returns a string with non-printing characters replaced by \\x notation"
|
|
238
310
|
fails "String#inspect taints the result if self is tainted"
|
|
239
311
|
fails "String#inspect untrusts the result if self is untrusted"
|
|
240
312
|
fails "String#lines does not care if the string is modified while substituting"
|
|
@@ -273,6 +345,7 @@ opal_filter "String" do
|
|
|
273
345
|
fails "String#reverse! raises a RuntimeError on a frozen instance that is modified"
|
|
274
346
|
fails "String#reverse! raises a RuntimeError on a frozen instance that would not be modified"
|
|
275
347
|
fails "String#reverse! reverses self in place and always returns self"
|
|
348
|
+
fails "String#rindex with Regexp supports \\G which matches at the given start offset"
|
|
276
349
|
fails "String#rjust with length, padding taints result when self or padstr is tainted"
|
|
277
350
|
fails "String#rjust with length, padding when padding is tainted and self is untainted returns a tainted string if and only if length is longer than self"
|
|
278
351
|
fails "String#rstrip taints the result when self is tainted"
|
|
@@ -304,11 +377,11 @@ opal_filter "String" do
|
|
|
304
377
|
fails "String#setbyte regards a negative index as counting from the end of the String"
|
|
305
378
|
fails "String#setbyte returns an Integer"
|
|
306
379
|
fails "String#setbyte sets a byte at an index greater than String size"
|
|
307
|
-
fails "String#slice with index, length always taints resulting strings when self is tainted"
|
|
308
380
|
fails "String#slice with Range always taints resulting strings when self is tainted"
|
|
309
381
|
fails "String#slice with Regexp, index always taints resulting strings when self or regexp is tainted"
|
|
310
382
|
fails "String#slice with String taints resulting strings when other is tainted"
|
|
311
383
|
fails "String#slice with Symbol raises TypeError"
|
|
384
|
+
fails "String#slice with index, length always taints resulting strings when self is tainted"
|
|
312
385
|
fails "String#slice! Range always taints resulting strings when self is tainted"
|
|
313
386
|
fails "String#slice! Range calls to_int on range arguments"
|
|
314
387
|
fails "String#slice! Range deletes and return the substring given by the offsets of the range"
|
|
@@ -317,16 +390,6 @@ opal_filter "String" do
|
|
|
317
390
|
fails "String#slice! Range returns nil if the given range is out of self"
|
|
318
391
|
fails "String#slice! Range returns subclass instances"
|
|
319
392
|
fails "String#slice! Range works with Range subclasses"
|
|
320
|
-
fails "String#slice! with index calls to_int on index"
|
|
321
|
-
fails "String#slice! with index deletes and return the char at the given position"
|
|
322
|
-
fails "String#slice! with index raises a RuntimeError if self is frozen"
|
|
323
|
-
fails "String#slice! with index returns nil if idx is outside of self"
|
|
324
|
-
fails "String#slice! with index, length always taints resulting strings when self is tainted"
|
|
325
|
-
fails "String#slice! with index, length calls to_int on idx and length"
|
|
326
|
-
fails "String#slice! with index, length deletes and returns the substring at idx and the given length"
|
|
327
|
-
fails "String#slice! with index, length raises a RuntimeError if self is frozen"
|
|
328
|
-
fails "String#slice! with index, length returns nil if the length is negative"
|
|
329
|
-
fails "String#slice! with index, length returns subclass instances"
|
|
330
393
|
fails "String#slice! with Regexp always taints resulting strings when self or regexp is tainted"
|
|
331
394
|
fails "String#slice! with Regexp deletes and returns the first match from self"
|
|
332
395
|
fails "String#slice! with Regexp doesn't taint self when regexp is tainted"
|
|
@@ -352,6 +415,16 @@ opal_filter "String" do
|
|
|
352
415
|
fails "String#slice! with String returns a subclass instance when given a subclass instance"
|
|
353
416
|
fails "String#slice! with String returns nil if self does not contain other"
|
|
354
417
|
fails "String#slice! with String taints resulting strings when other is tainted"
|
|
418
|
+
fails "String#slice! with index calls to_int on index"
|
|
419
|
+
fails "String#slice! with index deletes and return the char at the given position"
|
|
420
|
+
fails "String#slice! with index raises a RuntimeError if self is frozen"
|
|
421
|
+
fails "String#slice! with index returns nil if idx is outside of self"
|
|
422
|
+
fails "String#slice! with index, length always taints resulting strings when self is tainted"
|
|
423
|
+
fails "String#slice! with index, length calls to_int on idx and length"
|
|
424
|
+
fails "String#slice! with index, length deletes and returns the substring at idx and the given length"
|
|
425
|
+
fails "String#slice! with index, length raises a RuntimeError if self is frozen"
|
|
426
|
+
fails "String#slice! with index, length returns nil if the length is negative"
|
|
427
|
+
fails "String#slice! with index, length returns subclass instances"
|
|
355
428
|
fails "String#split with Regexp doesn't taints the resulting strings if the Regexp is tainted"
|
|
356
429
|
fails "String#split with Regexp respects the encoding of the regexp when splitting between characters"
|
|
357
430
|
fails "String#split with Regexp retains the encoding of the source string"
|
|
@@ -371,21 +444,16 @@ opal_filter "String" do
|
|
|
371
444
|
fails "String#strip! raises a RuntimeError on a frozen instance that is modified"
|
|
372
445
|
fails "String#strip! raises a RuntimeError on a frozen instance that would not be modified"
|
|
373
446
|
fails "String#strip! returns nil if no modifications where made"
|
|
374
|
-
fails "String#sub with pattern and block doesn't raise a RuntimeError if the string is modified while substituting"
|
|
375
|
-
fails "String#sub with pattern and block taints the result if the original string or replacement is tainted"
|
|
376
447
|
fails "String#sub with pattern and Hash ignores non-String keys"
|
|
377
448
|
fails "String#sub with pattern and Hash taints the result if a hash value is tainted"
|
|
378
449
|
fails "String#sub with pattern and Hash taints the result if the original string is tainted"
|
|
379
450
|
fails "String#sub with pattern and Hash untrusts the result if a hash value is untrusted"
|
|
380
451
|
fails "String#sub with pattern and Hash untrusts the result if the original string is untrusted"
|
|
452
|
+
fails "String#sub with pattern and block doesn't raise a RuntimeError if the string is modified while substituting"
|
|
453
|
+
fails "String#sub with pattern and block taints the result if the original string or replacement is tainted"
|
|
454
|
+
fails "String#sub with pattern, replacement raises a TypeError when pattern is a Symbol"
|
|
381
455
|
fails "String#sub with pattern, replacement supports \\G which matches at the beginning of the string"
|
|
382
456
|
fails "String#sub with pattern, replacement taints the result if the original string or replacement is tainted"
|
|
383
|
-
fails "String#sub! with pattern and block modifies self in place and returns self"
|
|
384
|
-
fails "String#sub! with pattern and block raises a RuntimeError if the string is modified while substituting"
|
|
385
|
-
fails "String#sub! with pattern and block raises a RuntimeError when self is frozen"
|
|
386
|
-
fails "String#sub! with pattern and block returns nil if no modifications were made"
|
|
387
|
-
fails "String#sub! with pattern and block sets $~ for access from the block"
|
|
388
|
-
fails "String#sub! with pattern and block taints self if block's result is tainted"
|
|
389
457
|
fails "String#sub! with pattern and Hash coerces the hash values with #to_s"
|
|
390
458
|
fails "String#sub! with pattern and Hash doesn't interpolate special sequences like \\1 for the block's return value"
|
|
391
459
|
fails "String#sub! with pattern and Hash ignores non-String keys"
|
|
@@ -399,6 +467,12 @@ opal_filter "String" do
|
|
|
399
467
|
fails "String#sub! with pattern and Hash uses a key's value only a single time"
|
|
400
468
|
fails "String#sub! with pattern and Hash uses the hash's default value for missing keys"
|
|
401
469
|
fails "String#sub! with pattern and Hash uses the hash's value set from default_proc for missing keys"
|
|
470
|
+
fails "String#sub! with pattern and block modifies self in place and returns self"
|
|
471
|
+
fails "String#sub! with pattern and block raises a RuntimeError if the string is modified while substituting"
|
|
472
|
+
fails "String#sub! with pattern and block raises a RuntimeError when self is frozen"
|
|
473
|
+
fails "String#sub! with pattern and block returns nil if no modifications were made"
|
|
474
|
+
fails "String#sub! with pattern and block sets $~ for access from the block"
|
|
475
|
+
fails "String#sub! with pattern and block taints self if block's result is tainted"
|
|
402
476
|
fails "String#sub! with pattern and without replacement and block raises a ArgumentError"
|
|
403
477
|
fails "String#sub! with pattern, replacement modifies self in place and returns self"
|
|
404
478
|
fails "String#sub! with pattern, replacement raises a RuntimeError when self is frozen"
|
|
@@ -464,74 +538,9 @@ opal_filter "String" do
|
|
|
464
538
|
fails "String#upcase! raises a RuntimeError when self is frozen"
|
|
465
539
|
fails "String#upcase! returns nil if no modifications were made"
|
|
466
540
|
fails "String#upto does not work with symbols"
|
|
467
|
-
fails "String#[] with index, length always taints resulting strings when self is tainted"
|
|
468
|
-
fails "String#[] with Range always taints resulting strings when self is tainted"
|
|
469
|
-
fails "String#[] with Regexp, index always taints resulting strings when self or regexp is tainted"
|
|
470
|
-
fails "String#[] with String taints resulting strings when other is tainted"
|
|
471
|
-
fails "String#[] with Symbol raises TypeError"
|
|
472
|
-
fails "String#[]= with a Range index raises a RangeError if negative Range begin is out of range"
|
|
473
|
-
fails "String#[]= with a Range index raises a RangeError if positive Range begin is greater than String size"
|
|
474
|
-
fails "String#[]= with a Range index replaces a partial string"
|
|
475
|
-
fails "String#[]= with a Range index replaces the contents with a longer String"
|
|
476
|
-
fails "String#[]= with a Range index replaces the contents with a shorter String"
|
|
477
|
-
fails "String#[]= with a Range index treats a negative out-of-range Range end with a negative Range begin as a zero count"
|
|
478
|
-
fails "String#[]= with a Range index treats a negative out-of-range Range end with a positive Range begin as a zero count"
|
|
479
|
-
fails "String#[]= with a Range index uses the Range end as an index rather than a count"
|
|
480
|
-
fails "String#[]= with a Range index with an empty replacement does not replace a character with a zero exclude-end range"
|
|
481
|
-
fails "String#[]= with a Range index with an empty replacement does not replace a character with a zero-index, zero exclude-end range"
|
|
482
|
-
fails "String#[]= with a Range index with an empty replacement replaces a character with a zero non-exclude-end range"
|
|
483
|
-
fails "String#[]= with a Range index with an empty replacement replaces a character with zero-index, zero non-exclude-end range"
|
|
484
|
-
fails "String#[]= with a Regexp index calls #to_str to convert the replacement"
|
|
485
|
-
fails "String#[]= with a Regexp index checks the match before calling #to_str to convert the replacement"
|
|
486
|
-
fails "String#[]= with a Regexp index raises IndexError if the regexp index doesn't match a position in the string"
|
|
487
|
-
fails "String#[]= with a Regexp index replaces the matched text with the rhs"
|
|
488
|
-
fails "String#[]= with a Regexp index with 3 arguments allows the specified capture to be negative and count from the end"
|
|
489
|
-
fails "String#[]= with a Regexp index with 3 arguments calls #to_int to convert the second object"
|
|
490
|
-
fails "String#[]= with a Regexp index with 3 arguments checks the match index before calling #to_str to convert the replacement"
|
|
491
|
-
fails "String#[]= with a Regexp index with 3 arguments raises a TypeError if #to_int does not return a Fixnum"
|
|
492
|
-
fails "String#[]= with a Regexp index with 3 arguments raises IndexError if the specified capture isn't available"
|
|
493
|
-
fails "String#[]= with a Regexp index with 3 arguments uses the 2nd of 3 arguments as which capture should be replaced"
|
|
494
|
-
fails "String#[]= with a Regexp index with 3 arguments when the optional capture does not match raises an IndexError before setting the replacement"
|
|
495
|
-
fails "String#[]= with Fixnum index allows assignment to the zero'th element of an empty String"
|
|
496
|
-
fails "String#[]= with Fixnum index calls #to_str to convert other to a String"
|
|
497
|
-
fails "String#[]= with Fixnum index calls to_int on index"
|
|
498
|
-
fails "String#[]= with Fixnum index raises a RuntimeError when self is frozen"
|
|
499
|
-
fails "String#[]= with Fixnum index raises a TypeError if other_str can't be converted to a String"
|
|
500
|
-
fails "String#[]= with Fixnum index raises an IndexError without changing self if idx is outside of self"
|
|
501
|
-
fails "String#[]= with Fixnum index raises IndexError if the string index doesn't match a position in the string"
|
|
502
|
-
fails "String#[]= with Fixnum index replaces the char at idx with other_str"
|
|
503
|
-
fails "String#[]= with Fixnum index taints self if other_str is tainted"
|
|
504
|
-
fails "String#[]= with Fixnum index, count appends other_str to the end of the string if idx == the length of the string"
|
|
505
|
-
fails "String#[]= with Fixnum index, count calls #to_int to convert the index and count objects"
|
|
506
|
-
fails "String#[]= with Fixnum index, count calls #to_str to convert the replacement object"
|
|
507
|
-
fails "String#[]= with Fixnum index, count counts negative idx values from end of the string"
|
|
508
|
-
fails "String#[]= with Fixnum index, count deletes characters if other_str is an empty string"
|
|
509
|
-
fails "String#[]= with Fixnum index, count deletes characters up to the maximum length of the existing string"
|
|
510
|
-
fails "String#[]= with Fixnum index, count overwrites and deletes characters if count is more than the length of other_str"
|
|
511
|
-
fails "String#[]= with Fixnum index, count raises a TypeError if #to_int for count does not return an Integer"
|
|
512
|
-
fails "String#[]= with Fixnum index, count raises a TypeError if #to_int for index does not return an Integer"
|
|
513
|
-
fails "String#[]= with Fixnum index, count raises a TypeError if other_str is a type other than String"
|
|
514
|
-
fails "String#[]= with Fixnum index, count raises a TypeError of #to_str does not return a String"
|
|
515
|
-
fails "String#[]= with Fixnum index, count raises an IndexError if count < 0"
|
|
516
|
-
fails "String#[]= with Fixnum index, count raises an IndexError if |idx| is greater than the length of the string"
|
|
517
|
-
fails "String#[]= with Fixnum index, count starts at idx and overwrites count characters before inserting the rest of other_str"
|
|
518
|
-
fails "String#[]= with Fixnum index, count taints self if other_str is tainted"
|
|
519
|
-
fails "String#[]= with String index raises an IndexError if the search String is not found"
|
|
520
|
-
fails "String#[]= with String index replaces characters with no characters"
|
|
521
|
-
fails "String#[]= with String index replaces fewer characters with more characters"
|
|
522
|
-
fails "String#[]= with String index replaces more characters with fewer characters"
|
|
523
541
|
fails "String.allocate returns a binary String"
|
|
524
542
|
fails "String.allocate returns a fully-formed String"
|
|
525
543
|
fails "String.new returns a binary String"
|
|
526
544
|
fails "String.new returns a fully-formed String"
|
|
527
545
|
fails "String.new returns a new string given a string argument"
|
|
528
|
-
fails "Ruby character strings taints the result of interpolation when an interpolated value is tainted"
|
|
529
|
-
fails "Ruby character strings untrusts the result of interpolation when an interpolated value is untrusted"
|
|
530
|
-
fails "Ruby character strings backslashes follow the same rules as interpolation"
|
|
531
|
-
fails "Ruby character strings are produced from control character shortcuts"
|
|
532
|
-
fails "Ruby character strings Unicode escaping can be done with \\u{} and one to six hex digits"
|
|
533
|
-
fails "Ruby character strings Unicode escaping with US-ASCII source encoding produces an ASCII string when escaping ASCII characters via \\u"
|
|
534
|
-
fails "Ruby character strings Unicode escaping with US-ASCII source encoding produces an ASCII string when escaping ASCII characters via \\u{}"
|
|
535
|
-
fails "Ruby character strings Unicode escaping with US-ASCII source encoding produces a UTF-8-encoded string when escaping non-ASCII characters via \\u"
|
|
536
|
-
fails "Ruby character strings Unicode escaping with US-ASCII source encoding produces a UTF-8-encoded string when escaping non-ASCII characters via \\u{}"
|
|
537
546
|
end
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
opal_unsupported_filter "Struct" do
|
|
2
2
|
fails "Struct#initialize is private"
|
|
3
3
|
fails "Struct.new does not create a constant with symbol as first argument"
|
|
4
4
|
fails "Struct.new fails with invalid constant name as first argument" # this invalid name gets interpreted as a struct member
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
opal_unsupported_filter "Symbol" do
|
|
2
2
|
fails "Numeric#coerce raises a TypeError when passed a Symbol"
|
|
3
3
|
fails "Fixnum#coerce raises a TypeError when given an Object that does not respond to #to_f"
|
|
4
4
|
fails "Symbol#to_proc produces a proc that always returns [[:rest]] for #parameters"
|
|
@@ -16,4 +16,5 @@ opal_filter "Symbol" do
|
|
|
16
16
|
fails "Marshal.dump with a Symbol dumps an encoded Symbol"
|
|
17
17
|
fails "Marshal.dump with a Symbol dumps a binary encoded Symbol"
|
|
18
18
|
fails "Marshal.dump with an Array dumps a non-empty Array" # this particular spec dumps a Symbol, spec with String instead of Symbol is in spec/opal/
|
|
19
|
+
fails "Hash literal raises a TypeError if any splatted elements keys are not symbols"
|
|
19
20
|
end
|
|
@@ -1,15 +1,30 @@
|
|
|
1
|
-
|
|
1
|
+
opal_unsupported_filter "taint" do
|
|
2
2
|
fails "Hash#reject with extra state does not taint the resulting hash"
|
|
3
|
-
|
|
4
|
-
fails "
|
|
3
|
+
fails "Kernel#inspect returns a tainted string if self is tainted"
|
|
4
|
+
fails "Module#append_features copies own tainted status to the given module"
|
|
5
|
+
fails "Module#append_features copies own untrusted status to the given module"
|
|
6
|
+
fails "Module#extend_object does not copy own tainted status to the given object"
|
|
7
|
+
fails "Module#extend_object does not copy own untrusted status to the given object"
|
|
8
|
+
fails "Module#prepend_features copies own tainted status to the given module"
|
|
9
|
+
fails "Module#prepend_features copies own untrusted status to the given module"
|
|
5
10
|
fails "String#% doesn't taint the result for %E when argument is tainted"
|
|
11
|
+
fails "String#% doesn't taint the result for %G when argument is tainted"
|
|
12
|
+
fails "String#% doesn't taint the result for %e when argument is tainted"
|
|
6
13
|
fails "String#% doesn't taint the result for %f when argument is tainted"
|
|
7
14
|
fails "String#% doesn't taint the result for %g when argument is tainted"
|
|
8
|
-
fails "String
|
|
9
|
-
fails "String#
|
|
15
|
+
fails "String#[] with Regexp always taints resulting strings when self or regexp is tainted"
|
|
16
|
+
fails "String#[] with Regexp returns an untrusted string if the regexp is untrusted"
|
|
10
17
|
fails "String#byteslice with Range always taints resulting strings when self is tainted"
|
|
11
|
-
|
|
12
|
-
fails "
|
|
18
|
+
fails "String#byteslice with index, length always taints resulting strings when self is tainted"
|
|
19
|
+
fails "String#dump taints the result if self is tainted"
|
|
20
|
+
fails "String#slice with Regexp always taints resulting strings when self or regexp is tainted"
|
|
21
|
+
fails "String#slice with Regexp returns an untrusted string if the regexp is untrusted"
|
|
22
|
+
fails "StringScanner#getbyte taints the returned String if the input was tainted"
|
|
23
|
+
fails "StringScanner#getch taints the returned String if the input was tainted"
|
|
24
|
+
fails "StringScanner#matched taints the returned String if the input was tainted"
|
|
25
|
+
fails "StringScanner#peek taints the returned String if the input was tainted"
|
|
26
|
+
fails "StringScanner#peep taints the returned String if the input was tainted"
|
|
13
27
|
fails "StringScanner#post_match taints the returned String if the input was tainted"
|
|
28
|
+
fails "StringScanner#pre_match taints the returned String if the input was tainted"
|
|
14
29
|
fails "StringScanner#rest taints the returned String if the input was tainted"
|
|
15
30
|
end
|
data/spec/lib/builder_spec.rb
CHANGED
|
@@ -69,4 +69,21 @@ describe Opal::Builder do
|
|
|
69
69
|
expect(builder.to_s).to start_with('(function(undefined)')
|
|
70
70
|
end
|
|
71
71
|
end
|
|
72
|
+
|
|
73
|
+
it 'defaults config from Opal::Config' do
|
|
74
|
+
Opal::Config.arity_check_enabled = false
|
|
75
|
+
expect(Opal::Config.arity_check_enabled).to eq(false)
|
|
76
|
+
expect(Opal::Config.compiler_options[:arity_check]).to eq(false)
|
|
77
|
+
builder = described_class.new
|
|
78
|
+
builder.build_str('def foo; end', 'foo')
|
|
79
|
+
expect(builder.to_s).not_to include('TMP_foo_1.$$parameters = []')
|
|
80
|
+
|
|
81
|
+
Opal::Config.arity_check_enabled = true
|
|
82
|
+
expect(Opal::Config.arity_check_enabled).to eq(true)
|
|
83
|
+
expect(Opal::Config.compiler_options[:arity_check]).to eq(true)
|
|
84
|
+
builder = described_class.new
|
|
85
|
+
builder.build_str('def foo; end', 'foo')
|
|
86
|
+
expect(builder.to_s).to include('TMP_foo_1.$$parameters = []')
|
|
87
|
+
end
|
|
88
|
+
|
|
72
89
|
end
|
|
@@ -3,9 +3,9 @@ require 'opal/cli_runners/phantomjs'
|
|
|
3
3
|
require 'stringio'
|
|
4
4
|
|
|
5
5
|
describe Opal::CliRunners::Phantomjs do
|
|
6
|
-
# FIXME: Unfotunately there are some issues on
|
|
6
|
+
# FIXME: Unfotunately there are some issues on 1.9.3, probably
|
|
7
7
|
# related to IO.pipe and process spawning in general.
|
|
8
|
-
before { pending if
|
|
8
|
+
before { pending if RUBY_VERSION == '1.9.3' }
|
|
9
9
|
|
|
10
10
|
it 'accepts arguments' do
|
|
11
11
|
expect(output_of(%{
|
data/spec/lib/cli_spec.rb
CHANGED
|
@@ -30,7 +30,7 @@ describe Opal::CLI do
|
|
|
30
30
|
expect { subject.run }.to raise_error(ArgumentError)
|
|
31
31
|
end
|
|
32
32
|
|
|
33
|
-
context 'with lib_only: true' do
|
|
33
|
+
context 'with lib_only: true and opal require' do
|
|
34
34
|
let(:options) { super().merge lib_only: true }
|
|
35
35
|
|
|
36
36
|
it 'does not raise an error' do
|
|
@@ -89,10 +89,16 @@ describe Opal::CLI do
|
|
|
89
89
|
end
|
|
90
90
|
|
|
91
91
|
context 'when true' do
|
|
92
|
-
let(:options) { {lib_only: true, compile: true,
|
|
92
|
+
let(:options) { {lib_only: true, compile: true, no_exit: true} }
|
|
93
|
+
it 'appends code block at the end of the source' do
|
|
94
|
+
expect_output_of{ subject.run }.not_to eq("\n")
|
|
95
|
+
end
|
|
93
96
|
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
context 'without any require' do
|
|
98
|
+
let(:options) { {lib_only: true, compile: true, skip_opal_require: true, no_exit: true} }
|
|
99
|
+
it 'raises ArgumentError' do
|
|
100
|
+
expect{subject.run}.to raise_error(ArgumentError)
|
|
101
|
+
end
|
|
96
102
|
end
|
|
97
103
|
end
|
|
98
104
|
end
|
|
@@ -123,7 +129,7 @@ describe Opal::CLI do
|
|
|
123
129
|
let(:options) { {:gems => [gem_name], :evals => ['']} }
|
|
124
130
|
|
|
125
131
|
it "adds the gem's lib paths to Opal.path" do
|
|
126
|
-
builder = cli.
|
|
132
|
+
builder = cli.builder
|
|
127
133
|
|
|
128
134
|
spec = Gem::Specification.find_by_name(gem_name)
|
|
129
135
|
spec.require_paths.each do |require_path|
|
|
@@ -176,21 +182,44 @@ describe Opal::CLI do
|
|
|
176
182
|
describe ':sexp option' do
|
|
177
183
|
let(:options) { {evals: ['puts 4'], sexp: true} }
|
|
178
184
|
it 'prints syntax expressions for the given code' do
|
|
179
|
-
expect_output_of{ subject.run }.to eq("(:
|
|
185
|
+
expect_output_of{ subject.run }.to eq("s(:send, nil, :puts,\n s(:int, 4))\n")
|
|
180
186
|
end
|
|
181
187
|
end
|
|
182
188
|
|
|
183
189
|
describe ':map option' do
|
|
184
|
-
let(:
|
|
190
|
+
let(:map_path) { "#{Dir.mktmpdir 'opal-map'}/file.map" }
|
|
191
|
+
let(:options) { {map: map_path, evals: ['123']} }
|
|
185
192
|
|
|
186
193
|
it 'sets the verbose flag (currently unused)' do
|
|
187
|
-
expect_output_of{ subject.run }.to
|
|
194
|
+
expect_output_of{ subject.run }.to eq('')
|
|
195
|
+
expect(File.read(map_path)).to include(%{"version":3})
|
|
188
196
|
end
|
|
189
197
|
end
|
|
190
198
|
|
|
199
|
+
describe ':parse_comments option' do
|
|
200
|
+
let(:code) do
|
|
201
|
+
<<-CODE
|
|
202
|
+
# multiline
|
|
203
|
+
# comment
|
|
204
|
+
def m
|
|
205
|
+
end
|
|
206
|
+
CODE
|
|
207
|
+
end
|
|
208
|
+
let(:options) { { parse_comments: true, evals: [code], compile: true } }
|
|
191
209
|
|
|
210
|
+
it 'sets $$comment prop for compiled methods' do
|
|
211
|
+
expect_output_of { subject.run }.to include('$$comments = ["# multiline", "# comment"]')
|
|
212
|
+
end
|
|
213
|
+
end
|
|
192
214
|
|
|
215
|
+
describe ':enable_source_location' do
|
|
216
|
+
let(:file) { File.expand_path('../fixtures/source_location_test.rb', __FILE__) }
|
|
217
|
+
let(:options) { { enable_source_location: true, compile: true, file: File.open(file) } }
|
|
193
218
|
|
|
219
|
+
it 'sets $$source_location prop for compiled methods' do
|
|
220
|
+
expect_output_of { subject.run }.to include("source_location_test.rb', 6]")
|
|
221
|
+
end
|
|
222
|
+
end
|
|
194
223
|
|
|
195
224
|
private
|
|
196
225
|
|