script_core 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.rubocop.yml +8 -6
- data/.ruby-version +1 -1
- data/Gemfile +2 -1
- data/bin/sandbox +1 -1
- data/ext/enterprise_script_service/Rakefile +1 -1
- data/ext/enterprise_script_service/flags.rb +5 -0
- data/ext/enterprise_script_service/libseccomp/CHANGELOG +15 -0
- data/ext/enterprise_script_service/libseccomp/CREDITS +3 -0
- data/ext/enterprise_script_service/libseccomp/Makefile.am +1 -1
- data/ext/enterprise_script_service/libseccomp/README.md +1 -1
- data/ext/enterprise_script_service/libseccomp/SECURITY.md +45 -0
- data/ext/enterprise_script_service/libseccomp/configure.ac +3 -3
- data/ext/enterprise_script_service/libseccomp/doc/admin/MAINTAINER_PROCESS.md +95 -0
- data/ext/enterprise_script_service/libseccomp/{RELEASE_PROCESS.md → doc/admin/RELEASE_PROCESS.md} +9 -1
- data/ext/enterprise_script_service/libseccomp/include/Makefile.am +1 -1
- data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +2292 -0
- data/ext/enterprise_script_service/libseccomp/include/seccomp.h.in +3 -1065
- data/ext/enterprise_script_service/libseccomp/src/arch-aarch64-syscalls.c +35 -3
- data/ext/enterprise_script_service/libseccomp/src/arch-arm-syscalls.c +35 -3
- data/ext/enterprise_script_service/libseccomp/src/arch-mips-syscalls.c +43 -11
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-parisc-syscalls.c +34 -2
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc-syscalls.c +43 -11
- data/ext/enterprise_script_service/libseccomp/src/arch-ppc64-syscalls.c +44 -12
- data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +46 -14
- data/ext/enterprise_script_service/libseccomp/src/arch-s390.c +142 -18
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +47 -15
- data/ext/enterprise_script_service/libseccomp/src/arch-s390x.c +143 -17
- data/ext/enterprise_script_service/libseccomp/src/arch-x32-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/arch-x86-syscalls.c +94 -12
- data/ext/enterprise_script_service/libseccomp/src/arch-x86.c +142 -19
- data/ext/enterprise_script_service/libseccomp/src/arch-x86_64-syscalls.c +33 -1
- data/ext/enterprise_script_service/libseccomp/src/db.c +1 -0
- data/ext/enterprise_script_service/libseccomp/src/gen_bpf.c +10 -3
- data/ext/enterprise_script_service/libseccomp/src/python/Makefile.am +4 -4
- data/ext/enterprise_script_service/libseccomp/src/python/seccomp.pyx +2 -0
- data/ext/enterprise_script_service/libseccomp/tests/.gitignore +1 -0
- data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.c +98 -0
- data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.py +61 -0
- data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.tests +18 -0
- data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +6 -3
- data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -2
- data/ext/enterprise_script_service/libseccomp/tools/check-syntax +1 -0
- data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +2 -0
- data/ext/enterprise_script_service/mruby-mpdecimal/src/ext.c +1 -1
- data/ext/enterprise_script_service/mruby/.gitignore +2 -2
- data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +10 -3
- data/ext/enterprise_script_service/mruby/Doxyfile +2408 -0
- data/ext/enterprise_script_service/mruby/README.md +21 -8
- data/ext/enterprise_script_service/mruby/Rakefile +4 -13
- data/ext/enterprise_script_service/mruby/appveyor_config.rb +1 -1
- data/ext/enterprise_script_service/mruby/build_config.rb +3 -3
- data/ext/enterprise_script_service/mruby/doc/guides/compile.md +42 -42
- data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
- data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +45 -6
- data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +5 -0
- data/ext/enterprise_script_service/mruby/doc/limitations.md +88 -38
- data/ext/enterprise_script_service/mruby/doc/mruby_logo_red_icon.png +0 -0
- data/ext/enterprise_script_service/mruby/doc/opcode.md +94 -94
- data/ext/enterprise_script_service/mruby/include/mrbconf.h +74 -11
- data/ext/enterprise_script_service/mruby/include/mruby.h +242 -146
- data/ext/enterprise_script_service/mruby/include/mruby/array.h +7 -7
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +2 -9
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +11 -10
- data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +104 -69
- data/ext/enterprise_script_service/mruby/include/mruby/class.h +7 -5
- data/ext/enterprise_script_service/mruby/include/mruby/common.h +9 -7
- data/ext/enterprise_script_service/mruby/include/mruby/compile.h +6 -6
- data/ext/enterprise_script_service/mruby/include/mruby/data.h +5 -5
- data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/dump.h +3 -7
- data/ext/enterprise_script_service/mruby/include/mruby/error.h +34 -6
- data/ext/enterprise_script_service/mruby/include/mruby/gc.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/hash.h +4 -11
- data/ext/enterprise_script_service/mruby/include/mruby/irep.h +16 -4
- data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -4
- data/ext/enterprise_script_service/mruby/include/mruby/khash.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +41 -7
- data/ext/enterprise_script_service/mruby/include/mruby/object.h +8 -9
- data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/ops.h +6 -6
- data/ext/enterprise_script_service/mruby/include/mruby/proc.h +19 -13
- data/ext/enterprise_script_service/mruby/include/mruby/range.h +10 -4
- data/ext/enterprise_script_service/mruby/include/mruby/re.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/string.h +130 -107
- data/ext/enterprise_script_service/mruby/include/mruby/throw.h +2 -2
- data/ext/enterprise_script_service/mruby/include/mruby/value.h +137 -49
- data/ext/enterprise_script_service/mruby/include/mruby/variable.h +3 -5
- data/ext/enterprise_script_service/mruby/include/mruby/version.h +24 -10
- data/ext/enterprise_script_service/mruby/lib/mruby-core-ext.rb +2 -39
- data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +32 -15
- data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +63 -17
- data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +24 -10
- data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +11 -7
- data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +81 -0
- data/ext/enterprise_script_service/mruby/minirake +27 -11
- data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +3 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +47 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +50 -29
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c +3 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +28 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +1 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +75 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +134 -90
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +7 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +69 -46
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +0 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +51 -59
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +430 -241
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrbgem.rake +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +122 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +249 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +153 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/mrblib/chain.rb +19 -17
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/test/enum_chain.rb +41 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +30 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/test/enum.rb +8 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +46 -14
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +51 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +10 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +47 -44
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-exit/src/mruby-exit.c +9 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +16 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/test/fiber.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +0 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +3 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +3 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +1 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +0 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +24 -38
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/kernel.rb +16 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +19 -18
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +5 -16
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +54 -42
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +24 -20
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file_test.rb +4 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +41 -35
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +9 -36
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +9 -27
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/test/kernel.rb +2 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +5 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +39 -24
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +48 -17
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/method.rb +0 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +134 -101
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +9 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +1 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +17 -37
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +0 -8
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrbgem.rake +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrblib/object.rb +15 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +35 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/test/nil.rb +4 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +1 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +28 -23
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/test/pack.rb +43 -49
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +3 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +6 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.rb +21 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +157 -124
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +72 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +38 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +26 -11
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +111 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrbgem.rake +5 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +117 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +209 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +308 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +10 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +22 -24
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrbgem.rake +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +8 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +116 -117
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/numeric.rb +29 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/range.rb +26 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/string.rb +32 -50
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +5 -7
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +43 -57
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/test/struct.rb +16 -11
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +2 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +152 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +4 -3
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +200 -0
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/include/mruby/time.h +2 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +199 -68
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/test/time.rb +81 -46
- data/ext/enterprise_script_service/mruby/mrblib/array.rb +14 -16
- data/ext/enterprise_script_service/mruby/mrblib/enum.rb +13 -9
- data/ext/enterprise_script_service/mruby/mrblib/hash.rb +5 -7
- data/ext/enterprise_script_service/mruby/mrblib/kernel.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +4 -4
- data/ext/enterprise_script_service/mruby/mrblib/range.rb +1 -1
- data/ext/enterprise_script_service/mruby/mrblib/string.rb +55 -112
- data/ext/enterprise_script_service/mruby/mruby-source.gemspec +1 -1
- data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby.dict +105 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_fuzzer.options +5 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_proto_fuzzer.options +4 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_fuzzer.c +18 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +44 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.cpp +455 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +55 -0
- data/ext/enterprise_script_service/mruby/oss-fuzz/ruby.proto +201 -0
- data/ext/enterprise_script_service/mruby/src/array.c +95 -46
- data/ext/enterprise_script_service/mruby/src/backtrace.c +6 -8
- data/ext/enterprise_script_service/mruby/src/class.c +370 -278
- data/ext/enterprise_script_service/mruby/src/codedump.c +34 -34
- data/ext/enterprise_script_service/mruby/src/debug.c +2 -2
- data/ext/enterprise_script_service/mruby/src/dump.c +8 -6
- data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
- data/ext/enterprise_script_service/mruby/src/error.c +157 -55
- data/ext/enterprise_script_service/mruby/src/etc.c +13 -46
- data/ext/enterprise_script_service/mruby/src/fmt_fp.c +2 -2
- data/ext/enterprise_script_service/mruby/src/gc.c +30 -11
- data/ext/enterprise_script_service/mruby/src/hash.c +23 -14
- data/ext/enterprise_script_service/mruby/src/kernel.c +16 -54
- data/ext/enterprise_script_service/mruby/src/load.c +40 -76
- data/ext/enterprise_script_service/mruby/src/numeric.c +164 -94
- data/ext/enterprise_script_service/mruby/src/object.c +16 -39
- data/ext/enterprise_script_service/mruby/src/pool.c +0 -2
- data/ext/enterprise_script_service/mruby/src/proc.c +47 -48
- data/ext/enterprise_script_service/mruby/src/range.c +22 -35
- data/ext/enterprise_script_service/mruby/src/state.c +5 -94
- data/ext/enterprise_script_service/mruby/src/string.c +874 -710
- data/ext/enterprise_script_service/mruby/src/symbol.c +73 -48
- data/ext/enterprise_script_service/mruby/src/variable.c +58 -38
- data/ext/enterprise_script_service/mruby/src/vm.c +133 -304
- data/ext/enterprise_script_service/mruby/tasks/doc.rake +48 -0
- data/ext/enterprise_script_service/mruby/tasks/toolchains/clang.rake +3 -4
- data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +20 -19
- data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +0 -12
- data/ext/enterprise_script_service/mruby/test/assert.rb +186 -25
- data/ext/enterprise_script_service/mruby/test/t/array.rb +34 -6
- data/ext/enterprise_script_service/mruby/test/t/class.rb +26 -0
- data/ext/enterprise_script_service/mruby/test/t/enumerable.rb +2 -2
- data/ext/enterprise_script_service/mruby/test/t/float.rb +17 -17
- data/ext/enterprise_script_service/mruby/test/t/hash.rb +2 -0
- data/ext/enterprise_script_service/mruby/test/t/integer.rb +14 -6
- data/ext/enterprise_script_service/mruby/test/t/kernel.rb +38 -19
- data/ext/enterprise_script_service/mruby/test/t/module.rb +87 -14
- data/ext/enterprise_script_service/mruby/test/t/numeric.rb +65 -23
- data/ext/enterprise_script_service/mruby/test/t/range.rb +4 -4
- data/ext/enterprise_script_service/mruby/test/t/string.rb +211 -49
- data/ext/enterprise_script_service/mruby/test/t/syntax.rb +19 -2
- data/ext/enterprise_script_service/mruby/test/t/vformat.rb +92 -0
- data/ext/enterprise_script_service/mruby/travis_config.rb +2 -2
- data/ext/enterprise_script_service/mruby_config.rb +10 -0
- data/ext/enterprise_script_service/mruby_engine.cpp +2 -2
- data/ext/enterprise_script_service/mruby_engine.gembox +1 -0
- data/ext/enterprise_script_service/msgpack/CHANGELOG.md +14 -0
- data/ext/enterprise_script_service/msgpack/Files.cmake +4 -0
- data/ext/enterprise_script_service/msgpack/README.md +1 -1
- data/ext/enterprise_script_service/msgpack/appveyor.yml +1 -1
- data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple.hpp.erb +1 -1
- data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple_decl.hpp.erb +1 -1
- data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_zone.hpp.erb +3 -3
- data/ext/enterprise_script_service/msgpack/example/boost/asio_send_recv.cpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/cpp11/timespec.hpp +16 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/wstring.hpp +15 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/object.h +2 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/pack_template.h +17 -9
- data/ext/enterprise_script_service/msgpack/include/msgpack/sysdep.h +27 -16
- data/ext/enterprise_script_service/msgpack/include/msgpack/type.hpp +2 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/unpack_template.h +5 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +0 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/check_container_size.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/chrono.hpp +5 -5
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/timespec.hpp +140 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple.hpp +32 -32
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple_decl.hpp +32 -32
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple.hpp +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple_decl.hpp +10 -10
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/ext.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/fixint.hpp +5 -4
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int.hpp +40 -13
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int_decl.hpp +3 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +121 -0
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp03_zone.hpp +3 -3
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp11_zone.hpp +3 -3
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object.hpp +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object_fwd.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/pack.hpp +40 -5
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/unpack.hpp +11 -11
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/vrefbuffer.hpp +7 -7
- data/ext/enterprise_script_service/msgpack/include/msgpack/v1/zbuffer.hpp +5 -5
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/adaptor/int_decl.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/create_object_visitor.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/parse.hpp +13 -13
- data/ext/enterprise_script_service/msgpack/include/msgpack/v2/x3_parse.hpp +28 -26
- data/ext/enterprise_script_service/msgpack/include/msgpack/v3/adaptor/int_decl.hpp +1 -1
- data/ext/enterprise_script_service/msgpack/include/msgpack/v3/parse.hpp +13 -13
- data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
- data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +6 -6
- data/ext/enterprise_script_service/msgpack/include/msgpack/zone.h +1 -1
- data/ext/enterprise_script_service/msgpack/src/objectc.c +83 -148
- data/ext/enterprise_script_service/msgpack/src/unpack.c +73 -47
- data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +1 -1
- data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +15 -9
- data/ext/enterprise_script_service/msgpack/test/buffer.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/carray.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/cases.cpp +7 -1
- data/ext/enterprise_script_service/msgpack/test/convert.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/fixint.cpp +7 -1
- data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +6 -1
- data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +8 -2
- data/ext/enterprise_script_service/msgpack/test/json.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/limit.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +128 -6
- data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +7 -2
- data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +20 -3
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +159 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +8 -3
- data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +23 -18
- data/ext/enterprise_script_service/msgpack/test/object.cpp +77 -45
- data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +28 -10
- data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +25 -18
- data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/raw.cpp +17 -12
- data/ext/enterprise_script_service/msgpack/test/reference.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +6 -2
- data/ext/enterprise_script_service/msgpack/test/streaming.cpp +10 -3
- data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/user_class.cpp +5 -0
- data/ext/enterprise_script_service/msgpack/test/version.cpp +6 -0
- data/ext/enterprise_script_service/msgpack/test/visitor.cpp +7 -0
- data/ext/enterprise_script_service/msgpack/test/zone.cpp +6 -0
- data/lib/script_core/version.rb +1 -1
- data/lib/tasks/mruby/engine.gembox.example +1 -0
- data/lib/tasks/script_core.rake +21 -3
- data/spec/dummy/app/helpers/fields_helper.rb +2 -2
- data/spec/dummy/mruby/engine.gembox +1 -0
- data/spec/script_core_spec.rb +1 -1
- metadata +38 -22
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.gitignore +0 -1
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.travis.yml +0 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/run_test.rb +0 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrblib/kernel.rb +0 -15
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/unbound_method.rb +0 -9
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.gitignore +0 -5
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.travis.yml +0 -2
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/packtest.rb +0 -157
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/run_test.rb +0 -26
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.c +0 -224
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.h +0 -80
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.h +0 -12
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.gitignore +0 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis.yml +0 -29
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis_build_config.rb +0 -6
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/Rakefile +0 -29
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/.travis.yml +0 -4
- data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/run_test.rb +0 -28
@@ -1,6 +1,19 @@
|
|
1
1
|
##
|
2
2
|
# Numeric ISO Test
|
3
3
|
|
4
|
+
def assert_step(exp, receiver, args, inf: false)
|
5
|
+
act = []
|
6
|
+
ret = receiver.step(*args) do |i|
|
7
|
+
act << i
|
8
|
+
break if inf && exp.size == act.size
|
9
|
+
end
|
10
|
+
expr = "#{receiver.inspect}.step(#{args.map(&:inspect).join(', ')})"
|
11
|
+
assert "assert_step" do
|
12
|
+
assert_true(exp.eql?(act), "#{expr}: counters", assertion_diff(exp, act))
|
13
|
+
assert_same(receiver, ret, "#{expr}: return value") unless inf
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
4
17
|
assert('Numeric', '15.2.7') do
|
5
18
|
assert_equal(Class, Numeric.class)
|
6
19
|
end
|
@@ -42,31 +55,60 @@
|
|
42
55
|
end
|
43
56
|
|
44
57
|
assert('Numeric#step') do
|
45
|
-
assert_step = ->(exp, receiver, args) do
|
46
|
-
inf = !args[0]
|
47
|
-
act = []
|
48
|
-
ret = receiver.step(*args) do |i|
|
49
|
-
act << i
|
50
|
-
break if inf && exp.size == act.size
|
51
|
-
end
|
52
|
-
expr = "#{receiver.inspect}.step(#{args.map(&:inspect).join(', ')})"
|
53
|
-
assert_true(exp.eql?(act), "#{expr}: counters", assertion_diff(exp, act))
|
54
|
-
assert_same(receiver, ret, "#{expr}: return value") unless inf
|
55
|
-
end
|
56
|
-
|
57
58
|
assert_raise(ArgumentError) { 1.step(2, 0) { break } }
|
58
|
-
assert_step
|
59
|
-
assert_step
|
60
|
-
assert_step
|
61
|
-
assert_step
|
62
|
-
assert_step
|
63
|
-
assert_step
|
59
|
+
assert_step([2, 3, 4], 2, [4])
|
60
|
+
assert_step([10, 8, 6, 4, 2], 10, [1, -2])
|
61
|
+
assert_step([], 2, [1, 3])
|
62
|
+
assert_step([], -2, [-1, -3])
|
63
|
+
assert_step([10, 11, 12, 13], 10, [], inf: true)
|
64
|
+
assert_step([10, 7, 4], 10, [nil, -3], inf: true)
|
64
65
|
|
65
66
|
skip unless Object.const_defined?(:Float)
|
67
|
+
inf = Float::INFINITY
|
66
68
|
assert_raise(ArgumentError) { 1.step(2, 0.0) { break } }
|
67
|
-
assert_step
|
68
|
-
assert_step
|
69
|
-
assert_step
|
70
|
-
assert_step
|
71
|
-
assert_step
|
69
|
+
assert_step([2.0, 3.0, 4.0], 2, [4.0])
|
70
|
+
assert_step([7.0, 4.0, 1.0, -2.0], 7, [-4, -3.0])
|
71
|
+
assert_step([2.0, 3.0, 4.0], 2.0, [4])
|
72
|
+
assert_step([10.0, 11.0, 12.0, 13.0], 10.0, [], inf: true)
|
73
|
+
assert_step([10.0, 7.0, 4.0], 10, [nil, -3.0], inf: true)
|
74
|
+
assert_step([1.0], 1, [nil, inf])
|
75
|
+
assert_step([1.0], 1, [nil, -inf])
|
76
|
+
assert_step([1.0], 1, [3, inf])
|
77
|
+
assert_step([], 1, [-3, inf])
|
78
|
+
assert_step([], 1, [3, -inf])
|
79
|
+
assert_step([1.0], 1, [-3, -inf])
|
80
|
+
assert_step([1.0], 1, [inf, inf])
|
81
|
+
assert_step([], 1, [inf, -inf])
|
82
|
+
assert_step([], 1, [-inf, inf])
|
83
|
+
assert_step([1.0], 1, [-inf, -inf])
|
84
|
+
assert_step([], inf, [2])
|
85
|
+
assert_step([], inf, [-2])
|
86
|
+
assert_step([], inf, [2, 3])
|
87
|
+
assert_step([inf, inf, inf], inf, [2, -3], inf: true)
|
88
|
+
assert_step([], inf, [2, inf])
|
89
|
+
assert_step([inf], inf, [2, -inf])
|
90
|
+
assert_step([], inf, [-2, inf])
|
91
|
+
assert_step([inf], inf, [-2, -inf])
|
92
|
+
assert_step([], inf, [-2, 3])
|
93
|
+
assert_step([inf, inf, inf], inf, [-2, -3], inf: true)
|
94
|
+
assert_step([inf], inf, [inf])
|
95
|
+
assert_step([], inf, [-inf])
|
96
|
+
assert_step([inf], inf, [inf, inf])
|
97
|
+
assert_step([inf], inf, [inf, -inf])
|
98
|
+
assert_step([inf], inf, [-inf, -inf])
|
99
|
+
assert_step([-inf, -inf, -inf], -inf, [2], inf: true)
|
100
|
+
assert_step([-inf, -inf, -inf], -inf, [-2], inf: true)
|
101
|
+
assert_step([-inf, -inf, -inf], -inf, [2, 3], inf: true)
|
102
|
+
assert_step([], -inf, [2, -3])
|
103
|
+
assert_step([-inf], -inf, [2, inf])
|
104
|
+
assert_step([], -inf, [2, -inf])
|
105
|
+
assert_step([-inf], -inf, [-2, inf])
|
106
|
+
assert_step([], -inf, [-2, -inf])
|
107
|
+
assert_step([-inf, -inf, -inf], -inf, [-2, 3], inf: true)
|
108
|
+
assert_step([], -inf, [-2, -3])
|
109
|
+
assert_step([-inf, -inf, -inf], -inf, [inf], inf: true)
|
110
|
+
assert_step([-inf], -inf, [-inf])
|
111
|
+
assert_step([-inf], -inf, [inf, inf])
|
112
|
+
assert_step([], -inf, [inf, -inf])
|
113
|
+
assert_step([-inf], -inf, [-inf, -inf])
|
72
114
|
end
|
@@ -101,12 +101,12 @@
|
|
101
101
|
|
102
102
|
assert('Range#dup') do
|
103
103
|
r = (1..3).dup
|
104
|
-
assert_equal r.begin
|
105
|
-
assert_equal r.end
|
104
|
+
assert_equal 1, r.begin
|
105
|
+
assert_equal 3, r.end
|
106
106
|
assert_false r.exclude_end?
|
107
107
|
|
108
108
|
r = ("a"..."z").dup
|
109
|
-
assert_equal r.begin
|
110
|
-
assert_equal r.end
|
109
|
+
assert_equal "a", r.begin
|
110
|
+
assert_equal "z", r.end
|
111
111
|
assert_true r.exclude_end?
|
112
112
|
end
|
@@ -2,7 +2,7 @@
|
|
2
2
|
##
|
3
3
|
# String ISO Test
|
4
4
|
|
5
|
-
UTF8STRING =
|
5
|
+
UTF8STRING = __ENCODING__ == "UTF-8"
|
6
6
|
|
7
7
|
assert('String', '15.2.10') do
|
8
8
|
assert_equal Class, String.class
|
@@ -37,49 +37,37 @@
|
|
37
37
|
assert('String#*', '15.2.10.5.5') do
|
38
38
|
assert_equal 'aaaaa', 'a' * 5
|
39
39
|
assert_equal '', 'a' * 0
|
40
|
-
assert_raise(ArgumentError)
|
41
|
-
|
42
|
-
|
40
|
+
assert_raise(ArgumentError) { 'a' * -1 }
|
41
|
+
assert_raise(TypeError) { 'a' * '1' }
|
42
|
+
assert_raise(TypeError) { 'a' * nil }
|
43
|
+
|
44
|
+
skip unless Object.const_defined?(:Float)
|
45
|
+
assert_equal 'aa', 'a' * 2.1
|
46
|
+
assert_raise(RangeError) { '' * 1e30 }
|
47
|
+
assert_raise(RangeError) { '' * Float::INFINITY }
|
48
|
+
assert_raise(RangeError) { '' * Float::NAN }
|
43
49
|
end
|
44
50
|
|
45
51
|
assert('String#[]', '15.2.10.5.6') do
|
46
52
|
# length of args is 1
|
47
|
-
a
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
53
|
+
assert_equal 'a', 'abc'[0]
|
54
|
+
assert_equal 'c', 'abc'[-1]
|
55
|
+
assert_nil 'abc'[10]
|
56
|
+
assert_nil 'abc'[-10]
|
57
|
+
assert_equal 'b', 'abc'[1.1] if Object.const_defined?(:Float)
|
52
58
|
|
53
59
|
# length of args is 2
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
# args is RegExp
|
61
|
-
# It will be tested in mrbgems.
|
60
|
+
assert_nil 'abc'[0, -1]
|
61
|
+
assert_nil 'abc'[10, 0]
|
62
|
+
assert_nil 'abc'[-10, 0]
|
63
|
+
assert_equal '', 'abc'[0, 0]
|
64
|
+
assert_equal 'bc', 'abc'[1, 2]
|
62
65
|
|
63
66
|
# args is String
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
# assert_equal 'c', b
|
69
|
-
# assert_nil c
|
70
|
-
# assert_nil d
|
71
|
-
# assert_equal 'b', e
|
72
|
-
# assert_nil a1
|
73
|
-
# assert_nil b1
|
74
|
-
# assert_nil c1
|
75
|
-
# assert_equal '', d1
|
76
|
-
# assert_equal 'bc', e1
|
77
|
-
# assert_equal 'bc', a3
|
78
|
-
# assert_nil b3
|
79
|
-
|
80
|
-
# assert_raise(TypeError) do
|
81
|
-
# a[nil]
|
82
|
-
# end
|
67
|
+
assert_equal 'bc', 'abc'['bc']
|
68
|
+
assert_nil 'abc'['XX']
|
69
|
+
|
70
|
+
assert_raise(TypeError) { 'abc'[nil] }
|
83
71
|
end
|
84
72
|
|
85
73
|
assert('String#[](UTF-8)', '15.2.10.5.6') do
|
@@ -161,6 +149,9 @@
|
|
161
149
|
assert_equal 'aXc', e
|
162
150
|
end
|
163
151
|
|
152
|
+
assert_raise(TypeError) { 'a'[0] = 1 }
|
153
|
+
assert_raise(TypeError) { 'a'[:a] = '1' }
|
154
|
+
|
164
155
|
# length of args is 2
|
165
156
|
a1 = 'abc'
|
166
157
|
assert_raise(IndexError) do
|
@@ -197,8 +188,62 @@
|
|
197
188
|
assert_raise(IndexError) do
|
198
189
|
b3['XX'] = 'Y'
|
199
190
|
end
|
191
|
+
|
192
|
+
assert_raise(TypeError) { 'a'[:a, 0] = '1' }
|
193
|
+
assert_raise(TypeError) { 'a'[0, :a] = '1' }
|
194
|
+
assert_raise(TypeError) { 'a'[0, 1] = 1 }
|
200
195
|
end
|
201
196
|
|
197
|
+
assert('String[]=(UTF-8)') do
|
198
|
+
a = "➀➁➂➃➄"
|
199
|
+
a[3] = "⚃"
|
200
|
+
assert_equal "➀➁➂⚃➄", a
|
201
|
+
|
202
|
+
b = "➀➁➂➃➄"
|
203
|
+
b[3, 0] = "⛄"
|
204
|
+
assert_equal "➀➁➂⛄➃➄", b
|
205
|
+
|
206
|
+
c = "➀➁➂➃➄"
|
207
|
+
c[3, 2] = "⚃⚄"
|
208
|
+
assert_equal "➀➁➂⚃⚄", c
|
209
|
+
|
210
|
+
d = "➀➁➂➃➄"
|
211
|
+
d[5] = "⛄"
|
212
|
+
assert_equal "➀➁➂➃➄⛄", d
|
213
|
+
|
214
|
+
e = "➀➁➂➃➄"
|
215
|
+
e[5, 0] = "⛄"
|
216
|
+
assert_equal "➀➁➂➃➄⛄", e
|
217
|
+
|
218
|
+
f = "➀➁➂➃➄"
|
219
|
+
f[5, 2] = "⛄"
|
220
|
+
assert_equal "➀➁➂➃➄⛄", f
|
221
|
+
|
222
|
+
g = "➀➁➂➃➄"
|
223
|
+
assert_raise(IndexError) { g[6] = "⛄" }
|
224
|
+
|
225
|
+
h = "➀➁➂➃➄"
|
226
|
+
assert_raise(IndexError) { h[6, 0] = "⛄" }
|
227
|
+
|
228
|
+
i = "➀➁➂➃➄"
|
229
|
+
assert_raise(IndexError) { i[6, 2] = "⛄" }
|
230
|
+
|
231
|
+
j = "➀➁➂➃➄"
|
232
|
+
j["➃"] = "⚃"
|
233
|
+
assert_equal "➀➁➂⚃➄", j
|
234
|
+
|
235
|
+
k = "➀➁➂➃➄"
|
236
|
+
assert_raise(IndexError) { k["⛄"] = "⛇" }
|
237
|
+
|
238
|
+
l = "➀➁➂➃➄"
|
239
|
+
assert_nothing_raised { l["➂"] = "" }
|
240
|
+
assert_equal "➀➁➃➄", l
|
241
|
+
|
242
|
+
m = "➀➁➂➃➄"
|
243
|
+
assert_raise(TypeError) { m["➂"] = nil }
|
244
|
+
assert_equal "➀➁➂➃➄", m
|
245
|
+
end if UTF8STRING
|
246
|
+
|
202
247
|
assert('String#capitalize', '15.2.10.5.7') do
|
203
248
|
a = 'abc'
|
204
249
|
a.capitalize
|
@@ -406,7 +451,22 @@
|
|
406
451
|
assert_equal 3, 'abcabc'.index('a', 1)
|
407
452
|
assert_equal 5, "hello".index("", 5)
|
408
453
|
assert_equal nil, "hello".index("", 6)
|
409
|
-
|
454
|
+
assert_equal 3, "hello".index("l", -2)
|
455
|
+
assert_raise(ArgumentError) { "hello".index }
|
456
|
+
assert_raise(TypeError) { "hello".index(101) }
|
457
|
+
end
|
458
|
+
|
459
|
+
assert('String#index(UTF-8)', '15.2.10.5.22') do
|
460
|
+
assert_equal 0, '⓿➊➋➌➍➎'.index('⓿')
|
461
|
+
assert_nil '⓿➊➋➌➍➎'.index('➓')
|
462
|
+
assert_equal 6, '⓿➊➋➌➍➎⓿➊➋➌➍➎'.index('⓿', 1)
|
463
|
+
assert_equal 6, '⓿➊➋➌➍➎⓿➊➋➌➍➎'.index('⓿', -7)
|
464
|
+
assert_equal 6, "⓿➊➋➌➍➎".index("", 6)
|
465
|
+
assert_equal nil, "⓿➊➋➌➍➎".index("", 7)
|
466
|
+
assert_equal 0, '⓿➊➋➌➍➎'.index("\xe2")
|
467
|
+
assert_equal nil, '⓿➊➋➌➍➎'.index("\xe3")
|
468
|
+
assert_equal 6, "\xd1\xd1\xd1\xd1\xd1\xd1⓿➊➋➌➍➎".index('⓿')
|
469
|
+
end if UTF8STRING
|
410
470
|
|
411
471
|
assert('String#initialize', '15.2.10.5.23') do
|
412
472
|
a = ''
|
@@ -469,6 +529,7 @@
|
|
469
529
|
|
470
530
|
assert_equal 'こんにちは世界!', a
|
471
531
|
assert_equal '!界世はちにんこ', 'こんにちは世界!'.reverse
|
532
|
+
assert_equal 'あ', 'あ'.reverse
|
472
533
|
end if UTF8STRING
|
473
534
|
|
474
535
|
assert('String#reverse!', '15.2.10.5.30') do
|
@@ -485,24 +546,44 @@
|
|
485
546
|
|
486
547
|
assert_equal '!界世はちにんこ', a
|
487
548
|
assert_equal '!界世はちにんこ', 'こんにちは世界!'.reverse!
|
549
|
+
|
550
|
+
b = 'あ'
|
551
|
+
b.reverse!
|
552
|
+
assert_equal 'あ', b
|
488
553
|
end if UTF8STRING
|
489
554
|
|
490
555
|
assert('String#rindex', '15.2.10.5.31') do
|
491
556
|
assert_equal 0, 'abc'.rindex('a')
|
557
|
+
assert_equal 0, 'abc'.rindex('a', 3)
|
558
|
+
assert_nil 'abc'.rindex('a', -4)
|
492
559
|
assert_nil 'abc'.rindex('d')
|
560
|
+
assert_equal 6, 'abcabc'.rindex('')
|
561
|
+
assert_equal 3, 'abcabc'.rindex('a')
|
493
562
|
assert_equal 0, 'abcabc'.rindex('a', 1)
|
494
563
|
assert_equal 3, 'abcabc'.rindex('a', 4)
|
564
|
+
assert_equal 0, 'abcabc'.rindex('a', -4)
|
565
|
+
assert_raise(ArgumentError) { "hello".rindex }
|
566
|
+
assert_raise(TypeError) { "hello".rindex(101) }
|
495
567
|
end
|
496
568
|
|
497
569
|
assert('String#rindex(UTF-8)', '15.2.10.5.31') do
|
498
570
|
str = "こんにちは世界!\nこんにちは世界!"
|
499
|
-
assert_nil str.
|
500
|
-
assert_equal
|
501
|
-
assert_equal
|
502
|
-
assert_equal
|
571
|
+
assert_nil str.rindex('さ')
|
572
|
+
assert_equal 12, str.rindex('ち')
|
573
|
+
assert_equal 3, str.rindex('ち', 10)
|
574
|
+
assert_equal 3, str.rindex('ち', -6)
|
575
|
+
|
576
|
+
broken = "\xf0☀\xf1☁\xf2☂\xf3☃\xf0☀\xf1☁\xf2☂\xf3☃"
|
577
|
+
assert_nil broken.rindex("\x81") # "\x81" is a part of "☁" ("\xe2\x98\x81")
|
578
|
+
assert_equal 11, broken.rindex("☁")
|
579
|
+
assert_equal 11, broken.rindex("☁", 12)
|
580
|
+
assert_equal 11, broken.rindex("☁", 11)
|
581
|
+
assert_equal 3, broken.rindex("☁", 10)
|
503
582
|
end if UTF8STRING
|
504
583
|
|
505
|
-
# 'String#scan', '15.2.10.5.32'
|
584
|
+
# assert('String#scan', '15.2.10.5.32') do
|
585
|
+
# # Not implemented yet
|
586
|
+
# end
|
506
587
|
|
507
588
|
assert('String#size', '15.2.10.5.33') do
|
508
589
|
assert_equal 3, 'abc'.size
|
@@ -667,12 +748,18 @@
|
|
667
748
|
end
|
668
749
|
|
669
750
|
assert('String#inspect', '15.2.10.5.46') do
|
751
|
+
assert_equal "\"\\x00\"", "\0".inspect
|
752
|
+
assert_equal "\"foo\"", "foo".inspect
|
753
|
+
if UTF8STRING
|
754
|
+
assert_equal '"る"', "る".inspect
|
755
|
+
else
|
756
|
+
assert_equal '"\xe3\x82\x8b"', "る".inspect
|
757
|
+
end
|
758
|
+
|
670
759
|
# should not raise an exception - regress #1210
|
671
760
|
assert_nothing_raised do
|
672
|
-
|
761
|
+
("\1" * 100).inspect
|
673
762
|
end
|
674
|
-
|
675
|
-
assert_equal "\"\\x00\"", "\0".inspect
|
676
763
|
end
|
677
764
|
|
678
765
|
# Not ISO specified
|
@@ -682,10 +769,6 @@
|
|
682
769
|
assert_equal "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA:", "#{a}:"
|
683
770
|
end
|
684
771
|
|
685
|
-
assert('Check the usage of a NUL character') do
|
686
|
-
"qqq\0ppp"
|
687
|
-
end
|
688
|
-
|
689
772
|
assert('String#bytes') do
|
690
773
|
str1 = "hello"
|
691
774
|
bytes1 = [104, 101, 108, 108, 111]
|
@@ -719,3 +802,82 @@
|
|
719
802
|
assert_equal 3, ('A' "B" 'C').size
|
720
803
|
assert_equal 4, (%(A) "B#{?C}" "D").size
|
721
804
|
end
|
805
|
+
|
806
|
+
assert('String#getbyte') do
|
807
|
+
str1 = "hello"
|
808
|
+
bytes1 = [104, 101, 108, 108, 111]
|
809
|
+
assert_equal bytes1[0], str1.getbyte(0)
|
810
|
+
assert_equal bytes1[-1], str1.getbyte(-1)
|
811
|
+
assert_equal bytes1[6], str1.getbyte(6)
|
812
|
+
|
813
|
+
str2 = "\xFF"
|
814
|
+
bytes2 = [0xFF]
|
815
|
+
assert_equal bytes2[0], str2.getbyte(0)
|
816
|
+
end
|
817
|
+
|
818
|
+
assert('String#setbyte') do
|
819
|
+
str1 = "hello"
|
820
|
+
h = "H".getbyte(0)
|
821
|
+
str1.setbyte(0, h)
|
822
|
+
assert_equal(h, str1.getbyte(0))
|
823
|
+
assert_equal("Hello", str1)
|
824
|
+
end
|
825
|
+
|
826
|
+
assert('String#byteslice') do
|
827
|
+
str1 = "hello"
|
828
|
+
str2 = "\u3042ab" # "\xE3\x81\x82ab"
|
829
|
+
|
830
|
+
assert_equal("h", str1.byteslice(0))
|
831
|
+
assert_equal("e", str1.byteslice(1))
|
832
|
+
assert_equal(nil, str1.byteslice(5))
|
833
|
+
assert_equal("o", str1.byteslice(-1))
|
834
|
+
assert_equal(nil, str1.byteslice(-6))
|
835
|
+
assert_equal("\xE3", str2.byteslice(0))
|
836
|
+
assert_equal("\x81", str2.byteslice(1))
|
837
|
+
assert_equal(nil, str2.byteslice(5))
|
838
|
+
assert_equal("b", str2.byteslice(-1))
|
839
|
+
assert_equal(nil, str2.byteslice(-6))
|
840
|
+
|
841
|
+
assert_equal("", str1.byteslice(0, 0))
|
842
|
+
assert_equal(str1, str1.byteslice(0, 6))
|
843
|
+
assert_equal("el", str1.byteslice(1, 2))
|
844
|
+
assert_equal("", str1.byteslice(5, 1))
|
845
|
+
assert_equal("o", str1.byteslice(-1, 6))
|
846
|
+
assert_equal(nil, str1.byteslice(-6, 1))
|
847
|
+
assert_equal(nil, str1.byteslice(0, -1))
|
848
|
+
assert_equal("", str2.byteslice(0, 0))
|
849
|
+
assert_equal(str2, str2.byteslice(0, 6))
|
850
|
+
assert_equal("\x81\x82", str2.byteslice(1, 2))
|
851
|
+
assert_equal("", str2.byteslice(5, 1))
|
852
|
+
assert_equal("b", str2.byteslice(-1, 6))
|
853
|
+
assert_equal(nil, str2.byteslice(-6, 1))
|
854
|
+
assert_equal(nil, str2.byteslice(0, -1))
|
855
|
+
|
856
|
+
assert_equal("ell", str1.byteslice(1..3))
|
857
|
+
assert_equal("el", str1.byteslice(1...3))
|
858
|
+
assert_equal("h", str1.byteslice(0..0))
|
859
|
+
assert_equal("", str1.byteslice(5..0))
|
860
|
+
assert_equal("o", str1.byteslice(4..5))
|
861
|
+
assert_equal(nil, str1.byteslice(6..0))
|
862
|
+
assert_equal("", str1.byteslice(-1..0))
|
863
|
+
assert_equal("llo", str1.byteslice(-3..5))
|
864
|
+
assert_equal("\x81\x82a", str2.byteslice(1..3))
|
865
|
+
assert_equal("\x81\x82", str2.byteslice(1...3))
|
866
|
+
assert_equal("\xE3", str2.byteslice(0..0))
|
867
|
+
assert_equal("", str2.byteslice(5..0))
|
868
|
+
assert_equal("b", str2.byteslice(4..5))
|
869
|
+
assert_equal(nil, str2.byteslice(6..0))
|
870
|
+
assert_equal("", str2.byteslice(-1..0))
|
871
|
+
assert_equal("\x82ab", str2.byteslice(-3..5))
|
872
|
+
|
873
|
+
assert_raise(ArgumentError) { str1.byteslice }
|
874
|
+
assert_raise(ArgumentError) { str1.byteslice(1, 2, 3) }
|
875
|
+
assert_raise(TypeError) { str1.byteslice("1") }
|
876
|
+
assert_raise(TypeError) { str1.byteslice("1", 2) }
|
877
|
+
assert_raise(TypeError) { str1.byteslice(1, "2") }
|
878
|
+
assert_raise(TypeError) { str1.byteslice(1..2, 3) }
|
879
|
+
|
880
|
+
skip unless Object.const_defined?(:Float)
|
881
|
+
assert_equal("o", str1.byteslice(4.0))
|
882
|
+
assert_equal("\x82ab", str2.byteslice(2.0, 3.0))
|
883
|
+
end
|