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.
Files changed (381) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -0
  3. data/.rubocop.yml +8 -6
  4. data/.ruby-version +1 -1
  5. data/Gemfile +2 -1
  6. data/bin/sandbox +1 -1
  7. data/ext/enterprise_script_service/Rakefile +1 -1
  8. data/ext/enterprise_script_service/flags.rb +5 -0
  9. data/ext/enterprise_script_service/libseccomp/CHANGELOG +15 -0
  10. data/ext/enterprise_script_service/libseccomp/CREDITS +3 -0
  11. data/ext/enterprise_script_service/libseccomp/Makefile.am +1 -1
  12. data/ext/enterprise_script_service/libseccomp/README.md +1 -1
  13. data/ext/enterprise_script_service/libseccomp/SECURITY.md +45 -0
  14. data/ext/enterprise_script_service/libseccomp/configure.ac +3 -3
  15. data/ext/enterprise_script_service/libseccomp/doc/admin/MAINTAINER_PROCESS.md +95 -0
  16. data/ext/enterprise_script_service/libseccomp/{RELEASE_PROCESS.md → doc/admin/RELEASE_PROCESS.md} +9 -1
  17. data/ext/enterprise_script_service/libseccomp/include/Makefile.am +1 -1
  18. data/ext/enterprise_script_service/libseccomp/include/seccomp-syscalls.h +2292 -0
  19. data/ext/enterprise_script_service/libseccomp/include/seccomp.h.in +3 -1065
  20. data/ext/enterprise_script_service/libseccomp/src/arch-aarch64-syscalls.c +35 -3
  21. data/ext/enterprise_script_service/libseccomp/src/arch-arm-syscalls.c +35 -3
  22. data/ext/enterprise_script_service/libseccomp/src/arch-mips-syscalls.c +43 -11
  23. data/ext/enterprise_script_service/libseccomp/src/arch-mips64-syscalls.c +33 -1
  24. data/ext/enterprise_script_service/libseccomp/src/arch-mips64n32-syscalls.c +33 -1
  25. data/ext/enterprise_script_service/libseccomp/src/arch-parisc-syscalls.c +34 -2
  26. data/ext/enterprise_script_service/libseccomp/src/arch-ppc-syscalls.c +43 -11
  27. data/ext/enterprise_script_service/libseccomp/src/arch-ppc64-syscalls.c +44 -12
  28. data/ext/enterprise_script_service/libseccomp/src/arch-s390-syscalls.c +46 -14
  29. data/ext/enterprise_script_service/libseccomp/src/arch-s390.c +142 -18
  30. data/ext/enterprise_script_service/libseccomp/src/arch-s390x-syscalls.c +47 -15
  31. data/ext/enterprise_script_service/libseccomp/src/arch-s390x.c +143 -17
  32. data/ext/enterprise_script_service/libseccomp/src/arch-x32-syscalls.c +33 -1
  33. data/ext/enterprise_script_service/libseccomp/src/arch-x86-syscalls.c +94 -12
  34. data/ext/enterprise_script_service/libseccomp/src/arch-x86.c +142 -19
  35. data/ext/enterprise_script_service/libseccomp/src/arch-x86_64-syscalls.c +33 -1
  36. data/ext/enterprise_script_service/libseccomp/src/db.c +1 -0
  37. data/ext/enterprise_script_service/libseccomp/src/gen_bpf.c +10 -3
  38. data/ext/enterprise_script_service/libseccomp/src/python/Makefile.am +4 -4
  39. data/ext/enterprise_script_service/libseccomp/src/python/seccomp.pyx +2 -0
  40. data/ext/enterprise_script_service/libseccomp/tests/.gitignore +1 -0
  41. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.c +98 -0
  42. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.py +61 -0
  43. data/ext/enterprise_script_service/libseccomp/tests/50-sim-hash_collision.tests +18 -0
  44. data/ext/enterprise_script_service/libseccomp/tests/Makefile.am +6 -3
  45. data/ext/enterprise_script_service/libseccomp/tools/Makefile.am +0 -2
  46. data/ext/enterprise_script_service/libseccomp/tools/check-syntax +1 -0
  47. data/ext/enterprise_script_service/libseccomp/tools/scmp_bpf_sim.c +2 -0
  48. data/ext/enterprise_script_service/mruby-mpdecimal/src/ext.c +1 -1
  49. data/ext/enterprise_script_service/mruby/.gitignore +2 -2
  50. data/ext/enterprise_script_service/mruby/CONTRIBUTING.md +10 -3
  51. data/ext/enterprise_script_service/mruby/Doxyfile +2408 -0
  52. data/ext/enterprise_script_service/mruby/README.md +21 -8
  53. data/ext/enterprise_script_service/mruby/Rakefile +4 -13
  54. data/ext/enterprise_script_service/mruby/appveyor_config.rb +1 -1
  55. data/ext/enterprise_script_service/mruby/build_config.rb +3 -3
  56. data/ext/enterprise_script_service/mruby/doc/guides/compile.md +42 -42
  57. data/ext/enterprise_script_service/mruby/doc/guides/debugger.md +1 -1
  58. data/ext/enterprise_script_service/mruby/doc/guides/mrbconf.md +45 -6
  59. data/ext/enterprise_script_service/mruby/doc/guides/mrbgems.md +5 -0
  60. data/ext/enterprise_script_service/mruby/doc/limitations.md +88 -38
  61. data/ext/enterprise_script_service/mruby/doc/mruby_logo_red_icon.png +0 -0
  62. data/ext/enterprise_script_service/mruby/doc/opcode.md +94 -94
  63. data/ext/enterprise_script_service/mruby/include/mrbconf.h +74 -11
  64. data/ext/enterprise_script_service/mruby/include/mruby.h +242 -146
  65. data/ext/enterprise_script_service/mruby/include/mruby/array.h +7 -7
  66. data/ext/enterprise_script_service/mruby/include/mruby/boxing_nan.h +2 -9
  67. data/ext/enterprise_script_service/mruby/include/mruby/boxing_no.h +11 -10
  68. data/ext/enterprise_script_service/mruby/include/mruby/boxing_word.h +104 -69
  69. data/ext/enterprise_script_service/mruby/include/mruby/class.h +7 -5
  70. data/ext/enterprise_script_service/mruby/include/mruby/common.h +9 -7
  71. data/ext/enterprise_script_service/mruby/include/mruby/compile.h +6 -6
  72. data/ext/enterprise_script_service/mruby/include/mruby/data.h +5 -5
  73. data/ext/enterprise_script_service/mruby/include/mruby/debug.h +2 -2
  74. data/ext/enterprise_script_service/mruby/include/mruby/dump.h +3 -7
  75. data/ext/enterprise_script_service/mruby/include/mruby/error.h +34 -6
  76. data/ext/enterprise_script_service/mruby/include/mruby/gc.h +2 -2
  77. data/ext/enterprise_script_service/mruby/include/mruby/hash.h +4 -11
  78. data/ext/enterprise_script_service/mruby/include/mruby/irep.h +16 -4
  79. data/ext/enterprise_script_service/mruby/include/mruby/istruct.h +4 -4
  80. data/ext/enterprise_script_service/mruby/include/mruby/khash.h +2 -2
  81. data/ext/enterprise_script_service/mruby/include/mruby/numeric.h +41 -7
  82. data/ext/enterprise_script_service/mruby/include/mruby/object.h +8 -9
  83. data/ext/enterprise_script_service/mruby/include/mruby/opcode.h +2 -2
  84. data/ext/enterprise_script_service/mruby/include/mruby/ops.h +6 -6
  85. data/ext/enterprise_script_service/mruby/include/mruby/proc.h +19 -13
  86. data/ext/enterprise_script_service/mruby/include/mruby/range.h +10 -4
  87. data/ext/enterprise_script_service/mruby/include/mruby/re.h +2 -2
  88. data/ext/enterprise_script_service/mruby/include/mruby/string.h +130 -107
  89. data/ext/enterprise_script_service/mruby/include/mruby/throw.h +2 -2
  90. data/ext/enterprise_script_service/mruby/include/mruby/value.h +137 -49
  91. data/ext/enterprise_script_service/mruby/include/mruby/variable.h +3 -5
  92. data/ext/enterprise_script_service/mruby/include/mruby/version.h +24 -10
  93. data/ext/enterprise_script_service/mruby/lib/mruby-core-ext.rb +2 -39
  94. data/ext/enterprise_script_service/mruby/lib/mruby/build.rb +32 -15
  95. data/ext/enterprise_script_service/mruby/lib/mruby/build/command.rb +63 -17
  96. data/ext/enterprise_script_service/mruby/lib/mruby/build/load_gems.rb +24 -10
  97. data/ext/enterprise_script_service/mruby/lib/mruby/gem.rb +11 -7
  98. data/ext/enterprise_script_service/mruby/lib/mruby/lockfile.rb +81 -0
  99. data/ext/enterprise_script_service/mruby/minirake +27 -11
  100. data/ext/enterprise_script_service/mruby/mrbgems/default.gembox +3 -0
  101. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrbgem.rake +0 -1
  102. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +47 -9
  103. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/src/array.c +3 -3
  104. data/ext/enterprise_script_service/mruby/mrbgems/mruby-array-ext/test/array.rb +50 -29
  105. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apibreak.c +3 -3
  106. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/apiprint.c +2 -2
  107. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/cmdprint.c +3 -3
  108. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.c +2 -2
  109. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdb.h +1 -1
  110. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-debugger/tools/mrdb/mrdbconf.h +4 -0
  111. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +28 -1
  112. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mrbc/tools/mrbc/mrbc.c +1 -2
  113. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/bintest/mruby.rb +75 -8
  114. data/ext/enterprise_script_service/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +134 -90
  115. data/ext/enterprise_script_service/mruby/mrbgems/mruby-class-ext/src/class.c +7 -8
  116. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/codegen.c +69 -46
  117. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/keywords +0 -3
  118. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/lex.def +51 -59
  119. data/ext/enterprise_script_service/mruby/mrbgems/mruby-compiler/core/parse.y +430 -241
  120. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrbgem.rake +10 -0
  121. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/mrblib/complex.rb +122 -0
  122. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/src/complex.c +249 -0
  123. data/ext/enterprise_script_service/mruby/mrbgems/mruby-complex/test/complex.rb +153 -0
  124. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/mrblib/chain.rb +19 -17
  125. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-chain/test/enum_chain.rb +41 -9
  126. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +30 -4
  127. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enum-ext/test/enum.rb +8 -3
  128. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrbgem.rake +0 -1
  129. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/mrblib/enumerator.rb +46 -14
  130. data/ext/enterprise_script_service/mruby/mrbgems/mruby-enumerator/test/enumerator.rb +51 -2
  131. data/ext/enterprise_script_service/mruby/mrbgems/mruby-error/src/exception.c +10 -0
  132. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/src/eval.c +47 -44
  133. data/ext/enterprise_script_service/mruby/mrbgems/mruby-eval/test/eval.rb +2 -2
  134. data/ext/enterprise_script_service/mruby/mrbgems/mruby-exit/src/mruby-exit.c +9 -4
  135. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/src/fiber.c +16 -12
  136. data/ext/enterprise_script_service/mruby/mrbgems/mruby-fiber/test/fiber.rb +1 -1
  137. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +0 -2
  138. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +3 -0
  139. data/ext/enterprise_script_service/mruby/mrbgems/mruby-hash-ext/test/hash.rb +3 -7
  140. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/README.md +1 -3
  141. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrbgem.rake +1 -1
  142. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/file.rb +0 -5
  143. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/io.rb +24 -38
  144. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/mrblib/kernel.rb +16 -0
  145. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file.c +19 -18
  146. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/file_test.c +5 -16
  147. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/src/io.c +54 -42
  148. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file.rb +24 -20
  149. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/file_test.rb +4 -9
  150. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/io.rb +41 -35
  151. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/test/mruby_io_test.c +9 -36
  152. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrbgem.rake +1 -1
  153. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/src/kernel.c +9 -27
  154. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/test/kernel.rb +2 -0
  155. data/ext/enterprise_script_service/mruby/mrbgems/mruby-math/src/math.c +5 -2
  156. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/src/metaprog.c +39 -24
  157. data/ext/enterprise_script_service/mruby/mrbgems/mruby-metaprog/test/metaprog.rb +48 -17
  158. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/method.rb +0 -12
  159. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/src/method.c +134 -101
  160. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/test/method.rb +9 -1
  161. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/mrblib/numeric_ext.rb +1 -5
  162. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +17 -37
  163. data/ext/enterprise_script_service/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +0 -8
  164. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrbgem.rake +1 -1
  165. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/mrblib/object.rb +15 -1
  166. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/src/object.c +35 -6
  167. data/ext/enterprise_script_service/mruby/mrbgems/mruby-object-ext/test/nil.rb +4 -0
  168. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +1 -5
  169. data/ext/enterprise_script_service/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +1 -1
  170. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/src/pack.c +28 -23
  171. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/test/pack.rb +43 -49
  172. data/ext/enterprise_script_service/mruby/mrbgems/mruby-print/mrblib/print.rb +3 -9
  173. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/src/proc.c +6 -9
  174. data/ext/enterprise_script_service/mruby/mrbgems/mruby-proc-ext/test/proc.rb +21 -5
  175. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.c +157 -124
  176. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/test/random.rb +72 -26
  177. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/mrblib/range.rb +38 -0
  178. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/src/range.c +26 -11
  179. data/ext/enterprise_script_service/mruby/mrbgems/mruby-range-ext/test/range.rb +111 -1
  180. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrbgem.rake +5 -0
  181. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/mrblib/rational.rb +117 -0
  182. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/src/rational.c +209 -0
  183. data/ext/enterprise_script_service/mruby/mrbgems/mruby-rational/test/rational.rb +308 -0
  184. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/README.md +1 -1
  185. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/src/socket.c +10 -9
  186. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/kernel.c +2 -2
  187. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sprintf/src/sprintf.c +22 -24
  188. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrbgem.rake +0 -1
  189. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +8 -4
  190. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/src/string.c +116 -117
  191. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/numeric.rb +29 -0
  192. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/range.rb +26 -0
  193. data/ext/enterprise_script_service/mruby/mrbgems/mruby-string-ext/test/string.rb +32 -50
  194. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/mrblib/struct.rb +5 -7
  195. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/src/struct.c +43 -57
  196. data/ext/enterprise_script_service/mruby/mrbgems/mruby-struct/test/struct.rb +16 -11
  197. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +2 -2
  198. data/ext/enterprise_script_service/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +1 -1
  199. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/driver.c +152 -1
  200. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/mrbgem.rake +4 -3
  201. data/ext/enterprise_script_service/mruby/mrbgems/mruby-test/vformat.c +200 -0
  202. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/include/mruby/time.h +2 -1
  203. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/src/time.c +199 -68
  204. data/ext/enterprise_script_service/mruby/mrbgems/mruby-time/test/time.rb +81 -46
  205. data/ext/enterprise_script_service/mruby/mrblib/array.rb +14 -16
  206. data/ext/enterprise_script_service/mruby/mrblib/enum.rb +13 -9
  207. data/ext/enterprise_script_service/mruby/mrblib/hash.rb +5 -7
  208. data/ext/enterprise_script_service/mruby/mrblib/kernel.rb +1 -1
  209. data/ext/enterprise_script_service/mruby/mrblib/numeric.rb +4 -4
  210. data/ext/enterprise_script_service/mruby/mrblib/range.rb +1 -1
  211. data/ext/enterprise_script_service/mruby/mrblib/string.rb +55 -112
  212. data/ext/enterprise_script_service/mruby/mruby-source.gemspec +1 -1
  213. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby.dict +105 -0
  214. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_fuzzer.options +5 -0
  215. data/ext/enterprise_script_service/mruby/oss-fuzz/config/mruby_proto_fuzzer.options +4 -0
  216. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_fuzzer.c +18 -0
  217. data/ext/enterprise_script_service/mruby/oss-fuzz/mruby_proto_fuzzer.cpp +44 -0
  218. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.cpp +455 -0
  219. data/ext/enterprise_script_service/mruby/oss-fuzz/proto_to_ruby.h +55 -0
  220. data/ext/enterprise_script_service/mruby/oss-fuzz/ruby.proto +201 -0
  221. data/ext/enterprise_script_service/mruby/src/array.c +95 -46
  222. data/ext/enterprise_script_service/mruby/src/backtrace.c +6 -8
  223. data/ext/enterprise_script_service/mruby/src/class.c +370 -278
  224. data/ext/enterprise_script_service/mruby/src/codedump.c +34 -34
  225. data/ext/enterprise_script_service/mruby/src/debug.c +2 -2
  226. data/ext/enterprise_script_service/mruby/src/dump.c +8 -6
  227. data/ext/enterprise_script_service/mruby/src/enum.c +1 -1
  228. data/ext/enterprise_script_service/mruby/src/error.c +157 -55
  229. data/ext/enterprise_script_service/mruby/src/etc.c +13 -46
  230. data/ext/enterprise_script_service/mruby/src/fmt_fp.c +2 -2
  231. data/ext/enterprise_script_service/mruby/src/gc.c +30 -11
  232. data/ext/enterprise_script_service/mruby/src/hash.c +23 -14
  233. data/ext/enterprise_script_service/mruby/src/kernel.c +16 -54
  234. data/ext/enterprise_script_service/mruby/src/load.c +40 -76
  235. data/ext/enterprise_script_service/mruby/src/numeric.c +164 -94
  236. data/ext/enterprise_script_service/mruby/src/object.c +16 -39
  237. data/ext/enterprise_script_service/mruby/src/pool.c +0 -2
  238. data/ext/enterprise_script_service/mruby/src/proc.c +47 -48
  239. data/ext/enterprise_script_service/mruby/src/range.c +22 -35
  240. data/ext/enterprise_script_service/mruby/src/state.c +5 -94
  241. data/ext/enterprise_script_service/mruby/src/string.c +874 -710
  242. data/ext/enterprise_script_service/mruby/src/symbol.c +73 -48
  243. data/ext/enterprise_script_service/mruby/src/variable.c +58 -38
  244. data/ext/enterprise_script_service/mruby/src/vm.c +133 -304
  245. data/ext/enterprise_script_service/mruby/tasks/doc.rake +48 -0
  246. data/ext/enterprise_script_service/mruby/tasks/toolchains/clang.rake +3 -4
  247. data/ext/enterprise_script_service/mruby/tasks/toolchains/gcc.rake +20 -19
  248. data/ext/enterprise_script_service/mruby/tasks/toolchains/visualcpp.rake +0 -12
  249. data/ext/enterprise_script_service/mruby/test/assert.rb +186 -25
  250. data/ext/enterprise_script_service/mruby/test/t/array.rb +34 -6
  251. data/ext/enterprise_script_service/mruby/test/t/class.rb +26 -0
  252. data/ext/enterprise_script_service/mruby/test/t/enumerable.rb +2 -2
  253. data/ext/enterprise_script_service/mruby/test/t/float.rb +17 -17
  254. data/ext/enterprise_script_service/mruby/test/t/hash.rb +2 -0
  255. data/ext/enterprise_script_service/mruby/test/t/integer.rb +14 -6
  256. data/ext/enterprise_script_service/mruby/test/t/kernel.rb +38 -19
  257. data/ext/enterprise_script_service/mruby/test/t/module.rb +87 -14
  258. data/ext/enterprise_script_service/mruby/test/t/numeric.rb +65 -23
  259. data/ext/enterprise_script_service/mruby/test/t/range.rb +4 -4
  260. data/ext/enterprise_script_service/mruby/test/t/string.rb +211 -49
  261. data/ext/enterprise_script_service/mruby/test/t/syntax.rb +19 -2
  262. data/ext/enterprise_script_service/mruby/test/t/vformat.rb +92 -0
  263. data/ext/enterprise_script_service/mruby/travis_config.rb +2 -2
  264. data/ext/enterprise_script_service/mruby_config.rb +10 -0
  265. data/ext/enterprise_script_service/mruby_engine.cpp +2 -2
  266. data/ext/enterprise_script_service/mruby_engine.gembox +1 -0
  267. data/ext/enterprise_script_service/msgpack/CHANGELOG.md +14 -0
  268. data/ext/enterprise_script_service/msgpack/Files.cmake +4 -0
  269. data/ext/enterprise_script_service/msgpack/README.md +1 -1
  270. data/ext/enterprise_script_service/msgpack/appveyor.yml +1 -1
  271. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple.hpp.erb +1 -1
  272. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_msgpack_tuple_decl.hpp.erb +1 -1
  273. data/ext/enterprise_script_service/msgpack/erb/v1/cpp03_zone.hpp.erb +3 -3
  274. data/ext/enterprise_script_service/msgpack/example/boost/asio_send_recv.cpp +1 -1
  275. data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/cpp11/timespec.hpp +16 -0
  276. data/ext/enterprise_script_service/msgpack/include/msgpack/adaptor/wstring.hpp +15 -0
  277. data/ext/enterprise_script_service/msgpack/include/msgpack/object.h +2 -0
  278. data/ext/enterprise_script_service/msgpack/include/msgpack/pack_template.h +17 -9
  279. data/ext/enterprise_script_service/msgpack/include/msgpack/sysdep.h +27 -16
  280. data/ext/enterprise_script_service/msgpack/include/msgpack/type.hpp +2 -0
  281. data/ext/enterprise_script_service/msgpack/include/msgpack/unpack_template.h +5 -0
  282. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/array_ref.hpp +0 -1
  283. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/check_container_size.hpp +1 -1
  284. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/chrono.hpp +5 -5
  285. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/cpp11/timespec.hpp +140 -0
  286. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple.hpp +32 -32
  287. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp03_msgpack_tuple_decl.hpp +32 -32
  288. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple.hpp +6 -6
  289. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/detail/cpp11_msgpack_tuple_decl.hpp +10 -10
  290. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/ext.hpp +1 -1
  291. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/fixint.hpp +5 -4
  292. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int.hpp +40 -13
  293. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/int_decl.hpp +3 -2
  294. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/adaptor/wstring.hpp +121 -0
  295. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp03_zone.hpp +3 -3
  296. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/detail/cpp11_zone.hpp +3 -3
  297. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object.hpp +6 -6
  298. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/object_fwd.hpp +1 -1
  299. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/pack.hpp +40 -5
  300. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/unpack.hpp +11 -11
  301. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/vrefbuffer.hpp +7 -7
  302. data/ext/enterprise_script_service/msgpack/include/msgpack/v1/zbuffer.hpp +5 -5
  303. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/adaptor/int_decl.hpp +1 -1
  304. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/create_object_visitor.hpp +1 -1
  305. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/parse.hpp +13 -13
  306. data/ext/enterprise_script_service/msgpack/include/msgpack/v2/x3_parse.hpp +28 -26
  307. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/adaptor/int_decl.hpp +1 -1
  308. data/ext/enterprise_script_service/msgpack/include/msgpack/v3/parse.hpp +13 -13
  309. data/ext/enterprise_script_service/msgpack/include/msgpack/version_master.h +2 -2
  310. data/ext/enterprise_script_service/msgpack/include/msgpack/zbuffer.h +6 -6
  311. data/ext/enterprise_script_service/msgpack/include/msgpack/zone.h +1 -1
  312. data/ext/enterprise_script_service/msgpack/src/objectc.c +83 -148
  313. data/ext/enterprise_script_service/msgpack/src/unpack.c +73 -47
  314. data/ext/enterprise_script_service/msgpack/test/CMakeLists.txt +1 -1
  315. data/ext/enterprise_script_service/msgpack/test/array_ref.cpp +5 -0
  316. data/ext/enterprise_script_service/msgpack/test/boost_fusion.cpp +5 -0
  317. data/ext/enterprise_script_service/msgpack/test/boost_optional.cpp +7 -0
  318. data/ext/enterprise_script_service/msgpack/test/boost_string_ref.cpp +7 -0
  319. data/ext/enterprise_script_service/msgpack/test/boost_string_view.cpp +6 -0
  320. data/ext/enterprise_script_service/msgpack/test/boost_variant.cpp +15 -9
  321. data/ext/enterprise_script_service/msgpack/test/buffer.cpp +7 -0
  322. data/ext/enterprise_script_service/msgpack/test/carray.cpp +7 -0
  323. data/ext/enterprise_script_service/msgpack/test/cases.cpp +7 -1
  324. data/ext/enterprise_script_service/msgpack/test/convert.cpp +6 -0
  325. data/ext/enterprise_script_service/msgpack/test/fixint.cpp +7 -1
  326. data/ext/enterprise_script_service/msgpack/test/fixint_c.cpp +6 -1
  327. data/ext/enterprise_script_service/msgpack/test/fuzz_unpack_pack_fuzzer_cpp11.cpp +5 -0
  328. data/ext/enterprise_script_service/msgpack/test/iterator_cpp11.cpp +8 -2
  329. data/ext/enterprise_script_service/msgpack/test/json.cpp +6 -0
  330. data/ext/enterprise_script_service/msgpack/test/limit.cpp +7 -0
  331. data/ext/enterprise_script_service/msgpack/test/msgpack_basic.cpp +128 -6
  332. data/ext/enterprise_script_service/msgpack/test/msgpack_c.cpp +7 -2
  333. data/ext/enterprise_script_service/msgpack/test/msgpack_container.cpp +20 -3
  334. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp11.cpp +159 -0
  335. data/ext/enterprise_script_service/msgpack/test/msgpack_cpp17.cpp +5 -0
  336. data/ext/enterprise_script_service/msgpack/test/msgpack_stream.cpp +8 -3
  337. data/ext/enterprise_script_service/msgpack/test/msgpack_tuple.cpp +6 -0
  338. data/ext/enterprise_script_service/msgpack/test/msgpack_vref.cpp +5 -0
  339. data/ext/enterprise_script_service/msgpack/test/msgpack_x3_parse.cpp +23 -18
  340. data/ext/enterprise_script_service/msgpack/test/object.cpp +77 -45
  341. data/ext/enterprise_script_service/msgpack/test/object_with_zone.cpp +28 -10
  342. data/ext/enterprise_script_service/msgpack/test/pack_unpack.cpp +25 -18
  343. data/ext/enterprise_script_service/msgpack/test/pack_unpack_c.cpp +7 -0
  344. data/ext/enterprise_script_service/msgpack/test/raw.cpp +17 -12
  345. data/ext/enterprise_script_service/msgpack/test/reference.cpp +6 -0
  346. data/ext/enterprise_script_service/msgpack/test/reference_cpp11.cpp +6 -0
  347. data/ext/enterprise_script_service/msgpack/test/reference_wrapper_cpp11.cpp +6 -0
  348. data/ext/enterprise_script_service/msgpack/test/shared_ptr_cpp11.cpp +6 -0
  349. data/ext/enterprise_script_service/msgpack/test/size_equal_only.cpp +6 -2
  350. data/ext/enterprise_script_service/msgpack/test/streaming.cpp +10 -3
  351. data/ext/enterprise_script_service/msgpack/test/streaming_c.cpp +7 -0
  352. data/ext/enterprise_script_service/msgpack/test/unique_ptr_cpp11.cpp +6 -0
  353. data/ext/enterprise_script_service/msgpack/test/user_class.cpp +5 -0
  354. data/ext/enterprise_script_service/msgpack/test/version.cpp +6 -0
  355. data/ext/enterprise_script_service/msgpack/test/visitor.cpp +7 -0
  356. data/ext/enterprise_script_service/msgpack/test/zone.cpp +6 -0
  357. data/lib/script_core/version.rb +1 -1
  358. data/lib/tasks/mruby/engine.gembox.example +1 -0
  359. data/lib/tasks/script_core.rake +21 -3
  360. data/spec/dummy/app/helpers/fields_helper.rb +2 -2
  361. data/spec/dummy/mruby/engine.gembox +1 -0
  362. data/spec/script_core_spec.rb +1 -1
  363. metadata +38 -22
  364. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.gitignore +0 -1
  365. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/.travis.yml +0 -2
  366. data/ext/enterprise_script_service/mruby/mrbgems/mruby-io/run_test.rb +0 -26
  367. data/ext/enterprise_script_service/mruby/mrbgems/mruby-kernel-ext/mrblib/kernel.rb +0 -15
  368. data/ext/enterprise_script_service/mruby/mrbgems/mruby-method/mrblib/unbound_method.rb +0 -9
  369. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.gitignore +0 -5
  370. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/.travis.yml +0 -2
  371. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/packtest.rb +0 -157
  372. data/ext/enterprise_script_service/mruby/mrbgems/mruby-pack/run_test.rb +0 -26
  373. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.c +0 -224
  374. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/mt19937ar.h +0 -80
  375. data/ext/enterprise_script_service/mruby/mrbgems/mruby-random/src/random.h +0 -12
  376. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.gitignore +0 -4
  377. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis.yml +0 -29
  378. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/.travis_build_config.rb +0 -6
  379. data/ext/enterprise_script_service/mruby/mrbgems/mruby-sleep/Rakefile +0 -29
  380. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/.travis.yml +0 -4
  381. data/ext/enterprise_script_service/mruby/mrbgems/mruby-socket/run_test.rb +0 -28
@@ -0,0 +1,48 @@
1
+ desc 'generate document'
2
+ task :doc => [:api_doc, :capi_doc] do
3
+
4
+ end
5
+
6
+ desc 'generate yard docs'
7
+ task :api_doc do
8
+ begin
9
+ sh "mrbdoc"
10
+ rescue
11
+ puts "ERROR: To generate yard documentation, you should install yard-mruby gem."
12
+ puts " $ gem install yard-mruby yard-coderay"
13
+ end
14
+ end
15
+
16
+ desc 'generate doxygen docs'
17
+ task :capi_doc do
18
+ begin
19
+ sh "doxygen Doxyfile"
20
+ rescue
21
+ puts "ERROR: To generate C API documents, you need Doxygen."
22
+ puts " $ sudo apt-get install doxygen"
23
+ end
24
+ end
25
+
26
+ desc 'clean all built docs'
27
+ task :clean_api_doc do
28
+ FileUtils.rm_rf 'doc/api'
29
+ end
30
+
31
+ desc 'clean all built docs'
32
+ task :clean_capi_doc do
33
+ FileUtils.rm_rf 'doc/capi'
34
+ end
35
+
36
+ desc 'clean all built docs'
37
+ task :clean_doc => [:clean_api_doc, :clean_capi_doc] do
38
+ end
39
+
40
+ desc 'clean all built docs'
41
+ task :view_api => [:api_doc] do
42
+ sh 'xdg-open doc/api/index.html'
43
+ end
44
+
45
+ desc 'clean all built docs'
46
+ task :view_capi => [:capi_doc] do
47
+ sh 'xdg-open doc/capi/html/index.html'
48
+ end
@@ -1,9 +1,8 @@
1
1
  MRuby::Toolchain.new(:clang) do |conf, _params|
2
- toolchain :gcc
2
+ toolchain :gcc, default_command: 'clang'
3
3
 
4
4
  [conf.cc, conf.objc, conf.asm].each do |cc|
5
- cc.command = ENV['CC'] || 'clang'
5
+ cc.flags << '-Wzero-length-array' unless ENV['CFLAGS']
6
6
  end
7
- conf.cxx.command = ENV['CXX'] || 'clang++'
8
- conf.linker.command = ENV['LD'] || ENV['CXX'] || ENV['CC'] || 'clang'
7
+ conf.cxx.flags << '-Wzero-length-array' unless ENV['CXXFLAGS'] || ENV['CFLAGS']
9
8
  end
@@ -1,26 +1,27 @@
1
- MRuby::Toolchain.new(:gcc) do |conf, _params|
2
- [conf.cc, conf.objc, conf.asm].each do |cc|
3
- cc.command = ENV['CC'] || 'gcc'
4
- cc.flags = [ENV['CFLAGS'] || %w(-g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings -Wundef)]
5
- cc.option_include_path = '-I%s'
6
- cc.option_define = '-D%s'
7
- cc.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
8
- cc.cxx_compile_flag = '-x c++ -std=c++03'
9
- cc.cxx_exception_flag = '-fexceptions'
10
- end
1
+ MRuby::Toolchain.new(:gcc) do |conf, params|
2
+ default_command = params[:default_command] || 'gcc'
3
+ compiler_flags = %w(-g -O3 -Wall -Wundef)
4
+ c_mandatory_flags = %w(-std=gnu99)
5
+ cxx_invalid_flags = %w(-Wdeclaration-after-statement -Werror-implicit-function-declaration)
11
6
 
12
- [conf.cxx].each do |cxx|
13
- cxx.command = ENV['CXX'] || 'g++'
14
- cxx.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || %w(-g -O3 -Wall -Werror-implicit-function-declaration -Wundef)]
15
- cxx.option_include_path = '-I%s'
16
- cxx.option_define = '-D%s'
17
- cxx.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
18
- cxx.cxx_compile_flag = '-x c++ -std=c++03'
19
- cxx.cxx_exception_flag = '-fexceptions'
7
+ [conf.cc, conf.objc, conf.asm, conf.cxx].each do |compiler|
8
+ if compiler == conf.cxx
9
+ compiler.command = ENV['CXX'] || default_command.sub(/cc|$/, '++')
10
+ compiler.flags = [ENV['CXXFLAGS'] || ENV['CFLAGS'] || compiler_flags]
11
+ else
12
+ compiler.command = ENV['CC'] || default_command
13
+ compiler.flags = [c_mandatory_flags, ENV['CFLAGS'] || [compiler_flags, cxx_invalid_flags, %w(-Wwrite-strings)]]
14
+ end
15
+ compiler.option_include_path = '-I%s'
16
+ compiler.option_define = '-D%s'
17
+ compiler.compile_options = '%{flags} -MMD -o %{outfile} -c %{infile}'
18
+ compiler.cxx_compile_flag = '-x c++ -std=c++03'
19
+ compiler.cxx_exception_flag = '-fexceptions'
20
+ compiler.cxx_invalid_flags = c_mandatory_flags + cxx_invalid_flags
20
21
  end
21
22
 
22
23
  conf.linker do |linker|
23
- linker.command = ENV['LD'] || ENV['CXX'] || ENV['CC'] || 'gcc'
24
+ linker.command = ENV['LD'] || ENV['CXX'] || ENV['CC'] || default_command
24
25
  linker.flags = [ENV['LDFLAGS'] || %w()]
25
26
  linker.libraries = %w(m)
26
27
  linker.library_paths = []
@@ -54,16 +54,4 @@
54
54
  end
55
55
 
56
56
  conf.file_separator = '\\'
57
-
58
- # Unreliable detection and will result in invalid encoding errors for localized versions of Visual C++
59
- # if require 'open3'
60
- # Open3.popen3 conf.cc.command do |_, _, e, _|
61
- # if /Version (\d{2})\.\d{2}\.\d{5}/ =~ e.gets && $1.to_i <= 17
62
- # m = "# VS2010/2012 support will be dropped after the next release! #"
63
- # h = "#" * m.length
64
- # puts h, m, h
65
- # end
66
- # end
67
- # end
68
-
69
57
  end
@@ -1,17 +1,53 @@
1
+ $undefined = Object.new
1
2
  $ok_test = 0
2
3
  $ko_test = 0
3
4
  $kill_test = 0
5
+ $warning_test = 0
4
6
  $skip_test = 0
5
7
  $asserts = []
6
8
  $test_start = Time.now if Object.const_defined?(:Time)
7
9
 
10
+ # For bintest on Ruby
8
11
  unless RUBY_ENGINE == "mruby"
9
- # For bintest on Ruby
10
12
  def t_print(*args)
11
13
  print(*args)
12
14
  $stdout.flush
13
15
  nil
14
16
  end
17
+
18
+ def _str_match?(pattern, str)
19
+ File.fnmatch?(pattern, str, File::FNM_EXTGLOB|File::FNM_DOTMATCH)
20
+ end
21
+ end
22
+
23
+ class Array
24
+ def _assertion_join
25
+ join("-")
26
+ end
27
+ end
28
+
29
+ class String
30
+ def _assertion_indent(indent)
31
+ indent = indent.to_s
32
+ off = 0
33
+ str = self
34
+ while nl = index("\n", off)
35
+ nl += 1
36
+ nl += 1 while slice(nl) == "\n"
37
+ break if nl >= size
38
+ str = indent.dup if off == 0
39
+ str += slice(off, nl - off) + indent
40
+ off = nl
41
+ end
42
+
43
+ if off == 0
44
+ str = indent + self
45
+ else
46
+ str += slice(off..-1)
47
+ end
48
+
49
+ str
50
+ end
15
51
  end
16
52
 
17
53
  ##
@@ -21,14 +57,14 @@ def assertion_string(err, str, iso=nil, e=nil, bt=nil)
21
57
  msg += " [#{iso}]" if iso && !iso.empty?
22
58
  msg += " => #{e}" if e && !e.to_s.empty?
23
59
  msg += " (#{GEMNAME == 'mruby-test' ? 'core' : "mrbgems: #{GEMNAME}"})"
24
- if $mrbtest_assert && $mrbtest_assert.size > 0
60
+ if $mrbtest_assert
25
61
  $mrbtest_assert.each do |idx, assert_msg, diff|
26
62
  msg += "\n - Assertion[#{idx}]"
27
63
  msg += " #{assert_msg}." if assert_msg && !assert_msg.empty?
28
64
  msg += "\n#{diff}" if diff && !diff.empty?
29
65
  end
30
66
  end
31
- msg += "\nbacktrace:\n\t#{bt.join("\n\t")}" if bt
67
+ msg += "\nbacktrace:\n #{bt.join("\n ")}" if bt
32
68
  msg
33
69
  end
34
70
 
@@ -40,16 +76,42 @@ def assertion_string(err, str, iso=nil, e=nil, bt=nil)
40
76
  # iso : The ISO reference code of the feature
41
77
  # which will be tested by this
42
78
  # assertion
43
- def assert(str = 'Assertion failed', iso = '')
79
+ def assert(str = 'assert', iso = '')
44
80
  t_print(str, (iso != '' ? " [#{iso}]" : ''), ' : ') if $mrbtest_verbose
45
81
  begin
82
+ $mrbtest_child_noassert ||= [0]
83
+ $mrbtest_child_noassert << 0
84
+ parent_asserts = $asserts
85
+ $asserts = []
86
+ parent_mrbtest_assert = $mrbtest_assert
46
87
  $mrbtest_assert = []
47
- $mrbtest_assert_idx = 0
88
+
89
+ if $mrbtest_assert_idx && !$mrbtest_assert_idx.empty?
90
+ $mrbtest_assert_idx[-1] += 1
91
+ $mrbtest_assert_idx << 0
92
+ else
93
+ $mrbtest_assert_idx = [0]
94
+ class << $mrbtest_assert_idx
95
+ alias to_s _assertion_join
96
+ end
97
+ end
98
+
48
99
  yield
49
- if($mrbtest_assert.size > 0)
50
- $asserts.push(assertion_string('Fail: ', str, iso))
51
- $ko_test += 1
52
- t_print('F')
100
+ if $mrbtest_assert.size > 0
101
+ if $mrbtest_assert.size == $mrbtest_child_noassert[-1]
102
+ $asserts.push(assertion_string('Skip: ', str, iso))
103
+ $mrbtest_child_noassert[-2] += 1
104
+ $skip_test += 1
105
+ t_print('?')
106
+ else
107
+ $asserts.push(assertion_string('Fail: ', str, iso))
108
+ $ko_test += 1
109
+ t_print('F')
110
+ end
111
+ elsif $mrbtest_assert_idx[-1] == 0
112
+ $asserts.push(assertion_string('Warn: ', str, iso, 'no assertion'))
113
+ $warning_test += 1
114
+ t_print('W')
53
115
  else
54
116
  $ok_test += 1
55
117
  t_print('.')
@@ -57,6 +119,7 @@ def assert(str = 'Assertion failed', iso = '')
57
119
  rescue MRubyTestSkip => e
58
120
  $asserts.push(assertion_string('Skip: ', str, iso, e))
59
121
  $skip_test += 1
122
+ $mrbtest_child_noassert[-2] += 1
60
123
  t_print('?')
61
124
  rescue Exception => e
62
125
  bt = e.backtrace if $mrbtest_verbose
@@ -64,7 +127,25 @@ def assert(str = 'Assertion failed', iso = '')
64
127
  $kill_test += 1
65
128
  t_print('X')
66
129
  ensure
67
- $mrbtest_assert = nil
130
+ if $mrbtest_assert_idx.size > 1
131
+ $asserts.each do |mesg|
132
+ idx = $mrbtest_assert_idx[0..-2]._assertion_join
133
+ mesg = mesg._assertion_indent(" ")
134
+
135
+ # Give `mesg` as a `diff` argument to avoid adding extra periods.
136
+ parent_mrbtest_assert << [idx, nil, mesg]
137
+ end
138
+ else
139
+ parent_asserts.concat $asserts
140
+ end
141
+ $asserts = parent_asserts
142
+
143
+ $mrbtest_assert = parent_mrbtest_assert
144
+ $mrbtest_assert_idx.pop
145
+ $mrbtest_assert_idx = nil if $mrbtest_assert_idx.empty?
146
+ $mrbtest_child_noassert.pop
147
+
148
+ nil
68
149
  end
69
150
  t_print("\n") if $mrbtest_verbose
70
151
  end
@@ -75,11 +156,11 @@ def assertion_diff(exp, act)
75
156
  end
76
157
 
77
158
  def assert_true(obj, msg = nil, diff = nil)
78
- if $mrbtest_assert
79
- $mrbtest_assert_idx += 1
159
+ if $mrbtest_assert_idx && $mrbtest_assert_idx.size > 0
160
+ $mrbtest_assert_idx[-1] += 1
80
161
  unless obj == true
81
162
  diff ||= " Expected #{obj.inspect} to be true."
82
- $mrbtest_assert.push([$mrbtest_assert_idx, msg, diff])
163
+ $mrbtest_assert.push([$mrbtest_assert_idx.to_s, msg, diff])
83
164
  end
84
165
  end
85
166
  obj
@@ -127,6 +208,13 @@ def assert_nil(obj, msg = nil)
127
208
  assert_true(ret, msg, diff)
128
209
  end
129
210
 
211
+ def assert_not_nil(obj, msg = nil)
212
+ if ret = obj.nil?
213
+ diff = " Expected #{obj.inspect} to not be nil."
214
+ end
215
+ assert_false(ret, msg, diff)
216
+ end
217
+
130
218
  def assert_include(*args); _assert_include(true, *args) end
131
219
  def assert_not_include(*args); _assert_include(false, *args) end
132
220
  def _assert_include(affirmed, collection, obj, msg = nil)
@@ -136,6 +224,55 @@ def _assert_include(affirmed, collection, obj, msg = nil)
136
224
  assert_true(ret, msg, diff)
137
225
  end
138
226
 
227
+ def assert_predicate(*args); _assert_predicate(true, *args) end
228
+ def assert_not_predicate(*args); _assert_predicate(false, *args) end
229
+ def _assert_predicate(affirmed, obj, op, msg = nil)
230
+ unless ret = obj.__send__(op) == affirmed
231
+ diff = " Expected #{obj.inspect} to #{'not ' unless affirmed}be #{op}."
232
+ end
233
+ assert_true(ret, msg, diff)
234
+ end
235
+
236
+ def assert_operator(*args); _assert_operator(true, *args) end
237
+ def assert_not_operator(*args); _assert_operator(false, *args) end
238
+ def _assert_operator(affirmed, obj1, op, obj2 = $undefined, msg = nil)
239
+ return _assert_predicate(affirmed, obj1, op, msg) if $undefined.equal?(obj2)
240
+ unless ret = obj1.__send__(op, obj2) == affirmed
241
+ diff = " Expected #{obj1.inspect} to #{'not ' unless affirmed}be #{op} #{obj2.inspect}."
242
+ end
243
+ assert_true(ret, msg, diff)
244
+ end
245
+
246
+ ##
247
+ # Fail unless +str+ matches against +pattern+.
248
+ #
249
+ # +pattern+ is interpreted as pattern for File.fnmatch?. It may contain the
250
+ # following metacharacters:
251
+ #
252
+ # <code>*</code> ::
253
+ # Matches any string.
254
+ #
255
+ # <code>?</code> ::
256
+ # Matches any one character.
257
+ #
258
+ # <code>[_SET_]</code>, <code>[^_SET_]</code> (<code>[!_SET_]</code>) ::
259
+ # Matches any one character in _SET_. Behaves like character sets in
260
+ # Regexp, including set negation (<code>[^a-z]</code>).
261
+ #
262
+ # <code>{_A_,_B_}</code> ::
263
+ # Matches pattern _A_ or pattern _B_.
264
+ #
265
+ # <code> \ </code> ::
266
+ # Escapes the next character.
267
+ def assert_match(*args); _assert_match(true, *args) end
268
+ def assert_not_match(*args); _assert_match(false, *args) end
269
+ def _assert_match(affirmed, pattern, str, msg = nil)
270
+ unless ret = _str_match?(pattern, str) == affirmed
271
+ diff = " Expected #{pattern.inspect} to #{'not ' unless affirmed}match #{str.inspect}."
272
+ end
273
+ assert_true(ret, msg, diff)
274
+ end
275
+
139
276
  ##
140
277
  # Fails unless +obj+ is a kind of +cls+.
141
278
  def assert_kind_of(cls, obj, msg = nil)
@@ -149,11 +286,11 @@ def assert_kind_of(cls, obj, msg = nil)
149
286
  # Fails unless +exp+ is equal to +act+ in terms of a Float
150
287
  def assert_float(exp, act, msg = nil)
151
288
  e, a = exp.to_f, act.to_f
152
- if (e.infinite? || a.infinite?) && e != a ||
289
+ if e.finite? && a.finite? && (n = (e - a).abs) > Mrbtest::FLOAT_TOLERANCE
290
+ flunk(msg, " Expected |#{exp} - #{act}| (#{n}) to be <= #{Mrbtest::FLOAT_TOLERANCE}.")
291
+ elsif (e.infinite? || a.infinite?) && e != a ||
153
292
  e.nan? && !a.nan? || !e.nan? && a.nan?
154
293
  flunk(msg, " Expected #{act} to be #{exp}.")
155
- elsif (n = (e - a).abs) > Mrbtest::FLOAT_TOLERANCE
156
- flunk(msg, " Expected |#{exp} - #{act}| (#{n}) to be <= #{Mrbtest::FLOAT_TOLERANCE}.")
157
294
  else
158
295
  pass
159
296
  end
@@ -164,8 +301,9 @@ def assert_raise(*exc)
164
301
  exc = exc.empty? ? StandardError : exc.size == 1 ? exc[0] : exc
165
302
  begin
166
303
  yield
167
- rescue *exc
304
+ rescue *exc => e
168
305
  pass
306
+ e
169
307
  rescue Exception => e
170
308
  diff = " #{exc} exception expected, not\n" \
171
309
  " Class: <#{e.class}>\n" \
@@ -190,11 +328,33 @@ def assert_nothing_raised(msg = nil)
190
328
  end
191
329
  end
192
330
 
331
+ def assert_raise_with_message(*args, &block)
332
+ _assert_raise_with_message(:plain, *args, &block)
333
+ end
334
+ def assert_raise_with_message_pattern(*args, &block)
335
+ _assert_raise_with_message(:pattern, *args, &block)
336
+ end
337
+ def _assert_raise_with_message(type, exc, exp_msg, msg = nil, &block)
338
+ e = msg ? assert_raise(exc, msg, &block) : assert_raise(exc, &block)
339
+ e ? ($mrbtest_assert_idx[-1]-=1) : (return e)
340
+
341
+ err_msg = e.message
342
+ unless ret = type == :pattern ? _str_match?(exp_msg, err_msg) : exp_msg == err_msg
343
+ diff = " Expected Exception(#{exc}) was raised, but the message doesn't match.\n"
344
+ if type == :pattern
345
+ diff += " Expected #{exp_msg.inspect} to match #{err_msg.inspect}."
346
+ else
347
+ diff += assertion_diff(exp_msg, err_msg)
348
+ end
349
+ end
350
+ assert_true(ret, msg, diff)
351
+ end
352
+
193
353
  def pass
194
354
  assert_true(true)
195
355
  end
196
356
 
197
- def flunk(msg = nil, diff = "Epic Fail!")
357
+ def flunk(msg = "Epic Fail!", diff = "")
198
358
  assert_true(false, msg, diff)
199
359
  end
200
360
 
@@ -208,17 +368,18 @@ def report
208
368
  t_print("#{msg}\n")
209
369
  end
210
370
 
211
- $total_test = $ok_test + $ko_test + $kill_test + $skip_test
212
- t_print("Total: #{$total_test}\n")
371
+ $total_test = $ok_test + $ko_test + $kill_test + $warning_test + $skip_test
372
+ t_print(" Total: #{$total_test}\n")
213
373
 
214
- t_print(" OK: #{$ok_test}\n")
215
- t_print(" KO: #{$ko_test}\n")
216
- t_print("Crash: #{$kill_test}\n")
217
- t_print(" Skip: #{$skip_test}\n")
374
+ t_print(" OK: #{$ok_test}\n")
375
+ t_print(" KO: #{$ko_test}\n")
376
+ t_print(" Crash: #{$kill_test}\n")
377
+ t_print("Warning: #{$warning_test}\n")
378
+ t_print(" Skip: #{$skip_test}\n")
218
379
 
219
380
  if Object.const_defined?(:Time)
220
381
  t_time = Time.now - $test_start
221
- t_print(" Time: #{t_time.round(2)} seconds\n")
382
+ t_print(" Time: #{t_time.round(2)} seconds\n")
222
383
  end
223
384
 
224
385
  $ko_test == 0 && $kill_test == 0
@@ -298,11 +298,38 @@ class SubArray < Array
298
298
  end
299
299
 
300
300
  assert('Array#slice', '15.2.12.5.29') do
301
- a = "12345".slice(1, 3)
302
- b = a.slice(0)
303
-
304
- assert_equal("2:", "#{b}:")
305
- assert_equal(2, [1,2,3].[](1))
301
+ a = [*(1..100)]
302
+ b = a.dup
303
+
304
+ assert_equal(1, a.slice(0))
305
+ assert_equal(100, a.slice(99))
306
+ assert_nil(a.slice(100))
307
+ assert_equal(100, a.slice(-1))
308
+ assert_equal(99, a.slice(-2))
309
+ assert_equal(1, a.slice(-100))
310
+ assert_nil(a.slice(-101))
311
+ assert_equal([1], a.slice(0,1))
312
+ assert_equal([100], a.slice(99,1))
313
+ assert_equal([], a.slice(100,1))
314
+ assert_equal([100], a.slice(99,100))
315
+ assert_equal([100], a.slice(-1,1))
316
+ assert_equal([99], a.slice(-2,1))
317
+ assert_equal([10, 11, 12], a.slice(9, 3))
318
+ assert_equal([10, 11, 12], a.slice(-91, 3))
319
+ assert_nil(a.slice(-101, 2))
320
+ assert_equal([1], a.slice(0..0))
321
+ assert_equal([100], a.slice(99..99))
322
+ assert_equal([], a.slice(100..100))
323
+ assert_equal([100], a.slice(99..200))
324
+ assert_equal([100], a.slice(-1..-1))
325
+ assert_equal([99], a.slice(-2..-2))
326
+ assert_equal([10, 11, 12], a.slice(9..11))
327
+ assert_equal([10, 11, 12], a.slice(-91..-89))
328
+ assert_equal([10, 11, 12], a.slice(-91..-89))
329
+ assert_nil(a.slice(-101..-1))
330
+ assert_nil(a.slice(10, -3))
331
+ assert_equal([], a.slice(10..7))
332
+ assert_equal(b, a)
306
333
  end
307
334
 
308
335
  assert('Array#unshift', '15.2.12.5.30') do
@@ -319,11 +346,12 @@ class SubArray < Array
319
346
 
320
347
  assert('Array#to_s', '15.2.12.5.31 / 15.2.12.5.32') do
321
348
  a = [2, 3, 4, 5]
349
+ a[4] = a
322
350
  r1 = a.to_s
323
351
  r2 = a.inspect
324
352
 
325
353
  assert_equal(r2, r1)
326
- assert_equal("[2, 3, 4, 5]", r1)
354
+ assert_equal("[2, 3, 4, 5, [...]]", r1)
327
355
  end
328
356
 
329
357
  assert('Array#==', '15.2.12.5.33') do