47 Commits

Author SHA1 Message Date
dearblue 5be33b82c7 Need build/XXX/mrbgems/mruby-test directory
An error may occur when performing `rake clean all` or `rake clean test`.

The directory is needed before writing to `mrbgems/mruby-test/assert.c`.
2020-06-09 21:24:53 +09:00
Yukihiro "Matz" Matsumoto fd1cff7735 Fixed wrong usages of mrb_get_args in vformat.c. 2020-01-01 12:34:30 +09:00
KOBAYASHI Shuji b97ebf2aeb Avoid unneeded directory creation during rake -T, etc. 2019-12-29 17:46:55 +09:00
KOBAYASHI Shuji 26e6e75ba6 Use Rake DSL instead of commands of FileUtils
- Respect `--verbose(-v)` and `--dry-run(-n)` options.
- Silence warnings to keyword arguments on Ruby 2.7.
2019-12-27 16:49:32 +09:00
Yukihiro "Matz" Matsumoto 87809742f5 Fix mixed declarations in 429f6de 2019-12-19 10:00:33 +09:00
Yukihiro "Matz" Matsumoto 429f6defdd Reimplement vformat tests; close #4868
Avoid creating `Data` object that refers `mruby` objects.
Also close #4622 ref #4613
2019-12-19 09:35:51 +09:00
Yukihiro "Matz" Matsumoto 7f0e1fc90b Revert "%C value need not to be saved in TestVFormat::Native; close #4868"
This reverts commit f507ff4842.
It makes AppVeyor tests fail.
2019-12-19 00:07:08 +09:00
Yukihiro "Matz" Matsumoto f507ff4842 %C value need not to be saved in TestVFormat::Native; close #4868 2019-12-18 01:40:11 +09:00
Yukihiro "Matz" Matsumoto 98fc887cb3 Reorganize mrb_string_value_cstr and related functions.
`mrb_string_value_cstr` and `mrb_string_value_len`: obsolete
`mrb_string_cstr`: new function to retrieve NULL terminated C string
`RSTRING_CSTR`: wrapper macro of `mrb_string_cstr`
2019-08-07 15:52:10 +09:00
KOBAYASHI Shuji 1e9cb74cc6 Change second argument to %l of mrb_vformat() to size_t from mrb_int
- `size_t` is more commonly used.
- `len` argument of `mrb_str_new()` is `size_t`.

NOTE:

The test for `%l` is temporarily disabled because adding a new type to
`mrbgems/mruby-test/vformat.c` causes an error (memory error?) on Visual
Studio 2017 in AppVeyor.
2019-08-03 19:42:22 +09:00
KOBAYASHI Shuji a4243360a2 Fix mrb_vformat("%f") with MRB_USE_FLOAT
It potentially not work when `mrb_float` is `float` because `float` variable
in variable length arguments is promoted to `double`.

Also I fixed build with `MRB_WITHOUT_FLOAT`.
2019-08-03 11:54:45 +09:00
KOBAYASHI Shuji d1817e7791 Change the mrb_vformat specifier %d for int
It potentially breaks, for example, in the case of `mrb_int` is 64-bit
and more smaller type is passed by `%d`. In fact, the problem could
become apparent when I used `%d` to `backtrace_location::lineno` in
`src/backtrace.c:mrb_unpack_backtrace()` on AppVeyor.

Therefore, change `%d` for `int` (not `mrb_int`) so that it can be
used mostly without casting.
2019-08-02 19:22:08 +09:00
KOBAYASHI Shuji eea42e06af Add new specifiers/modifiers to format string of mrb_vfromat()
Format sequence syntax:

  %[modifier]specifier

Modifiers:

  ----------+------------------------------------------------------------
  Modifier  | Meaning
  ----------+------------------------------------------------------------
      !     | Convert to string by corresponding `inspect` instead of
            | corresponding `to_s`.
  ----------+------------------------------------------------------------

Specifiers:

  ----------+----------------+--------------------------------------------
  Specifier | Argument Type  | Note
  ----------+----------------+--------------------------------------------
      c     | char           |
     d,i    | mrb_int        |
      f     | mrb_float      |
      l     | char*, mrb_int | Arguments are string and length.
      n     | mrb_sym        |
      s     | char*          | Argument is NUL terminated string.
      t     | mrb_value      | Convert to type (class) of object.
     v,S    | mrb_value      |
      C     | struct RClass* |
      T     | mrb_value      | Convert to real type (class) of object.
      Y     | mrb_value      | Same as `!v` if argument is `true`, `false`
            |                | or `nil`, otherwise same as `T`.
      %     | -              | Convert to percent sign itself (no argument
            |                | taken).
  ----------+----------------+--------------------------------------------

This change will increase the binary size, but replacing all format strings
with new specifiers/modifiers will decrease the size because it reduces
inline expansion of `mrb_obj_value()`, etc. at the caller.
2019-08-01 13:24:52 +09:00
Yukihiro "Matz" Matsumoto cd8fc9bcb8 Resolved conflicts in #4320 2019-07-29 01:02:03 +09:00
Yukihiro "Matz" Matsumoto 7cf1bc39a7 Merge pull request #4356 from shuujii/add-assert_match-and-assert_not_match
Add `assert_match` and `assert_not_match`
2019-04-22 22:29:15 +09:00
KOBAYASHI Shuji 716a99b069 Add assert_match and assert_not_match 2019-04-14 19:06:28 +09:00
Yukihiro "Matz" Matsumoto b351bdb8d5 Fixed old style declaration; ref #4365 2019-04-10 06:00:38 +09:00
KOBAYASHI Shuji df4b081392 Refactor t_print for test 2019-03-23 19:27:21 +09:00
KOBAYASHI Shuji c3122c887a Do not raise an exception when bintest fail
- An exception do not raise when mrbtest fail.
- There are no useful informations in exception message and backtrace.
2019-03-13 22:04:14 +09:00
KOBAYASHI Shuji f6326803c7 Add a missing file for #4314 2019-03-07 21:36:54 +09:00
KOBAYASHI Shuji f209f781ac Integrate init_mrbtest.c to driver.c in mruby-test mrbgem
- `mrbgemtest_init()` is needed if `DISABLE_GEMS` is enabled because core
  tests are run as part of `mruby-test` mrbgem (moreover, `DISABLE_GEMS` is
  disabled when `enable_test` is used in build config).
- For the same reason `mrb_open_core()` etc for core tests is unneeded.
2019-02-22 20:41:20 +09:00
KOBAYASHI Shuji 366a14f297 Remove special treatments for MRB_WITHOUT_FLOAT in build scripts 2019-01-16 23:48:59 +09:00
Yukihiro "Matz" Matsumoto ae5463c9e4 Merge pull request #4148 from take-cheeze/rename_libmruby_stuff
Rename `MRuby::Build#libmruby` stuff to avoid confusion
2018-10-29 15:13:24 +09:00
take-cheeze b37b312081 Rename libmruby stuff to avoid confusion 2018-10-29 14:07:16 +09:00
take-cheeze c240aeada9 Add missing dependency of source code generator 2018-10-29 13:58:57 +09:00
Sebastián Katzer b1f1fe2f81 Fix task name is not necessarily a valid path
Errno::ENOENT: No such file or directory @ dir_s_mkdir - mruby:Z:/Documents
2018-07-08 13:51:00 +02:00
take-cheeze b8fec13cab Make codacy happy. 2018-06-20 18:29:11 +09:00
take-cheeze 1d7c69a7cb Fix dependencies. 2018-06-20 18:23:08 +09:00
take-cheeze a212428fed Comment out unused variable. 2018-06-20 18:22:50 +09:00
take-cheeze 633599a2cb Fix forgotten argument passing. 2018-06-20 18:21:57 +09:00
take-cheeze dfddc6a09f Fix dependencies. 2018-06-20 18:21:33 +09:00
take-cheeze f715f2ddea Fix unnecessary rebuild of tests. 2018-06-13 23:32:08 +09:00
Takeshi Watanabe 0f5cf385b8 Close mrb_state before exit. 2018-03-05 10:13:55 +09:00
Takeshi Watanabe 94aebe3137 Close on exception too. 2018-03-05 10:12:33 +09:00
YAMAMOTO Masaya 625f9f6fa3 Merge branch 'master' of github.com:mruby/mruby 2017-11-04 01:23:12 +09:00
Yukihiro "Matz" Matsumoto fda64be996 Flush stdout after every print from tests 2017-10-28 00:29:30 +09:00
YAMAMOTO Masaya dcd5d0ffec Test for MRB_WITHOUT_FLOAT 2017-10-11 17:58:11 +09:00
Tomasz Dąbrowski d713f8d761 fix: mrbgems\mruby-test\driver.c(67): warning C4244: '=': conversion from 'mrb_int' to 'int', possible loss of data 2017-09-27 22:22:04 +02:00
Tomasz Dąbrowski a8b8abbd82 Fixed float tolerance in tests when MRB_USE_FLOAT is set 2016-11-24 12:48:41 +01:00
Daniel Bovensiepen 5976185c0a Fix bug in mruby-test gem.
In an used build path mruby-test wasn't updating mrbtest.c in the
case that the mgem selection was changed. This lead to:
  - a missing reference in case a GEM was removed
  - ignoring all new GEMs added to the build configuration

This fix keeps track of the active gems and demands a rebuild of
mrbtest.c in case that the gem selection changed.
2016-02-12 02:19:18 +08:00
Yukihiro "Matz" Matsumoto 5c405dea3d include changed from by quotes ("") to by brackets (<>); close #3032 2015-11-27 17:48:23 +09:00
Zachary Scott 1ef2faf1a6 Remove unnecessary dependencies for assert_rb codegen and test_rbireps 2015-11-24 16:33:40 +09:00
Zachary Scott e7a301828f Remove mrbtest_irep from mrbtest
If we make the core tests a dependency on the mruby-test gem,
we don't need to worry about maintaining the core test irep alone.
2015-11-24 16:32:17 +09:00
Zachary Scott 1e3da80923 Ensure mrbs dependency is maintained for mruby-test 2015-10-24 21:14:54 +09:00
Zachary Scott bacb826868 Add build_mrbtest after config block is evaluated
This allows us to add `enable_test` anywhere in a build target,
without having to worry about the order in which they are included.

Previously, there was a bug that occured when adding 'mruby-test' gem
to dependencies before additional gems.

Instead of adding the 'mruby-test' gem dependency manually to a test build,
we now only need to call `enable_test` in the target. This also allows us to
call `test_enabled?` downstream when running mruby tests ourselves.

/cc #2924
2015-09-03 01:02:53 -04:00
Zachary Scott c7d0f8ebcb Refactor test/mrbtest.rake and tasks/mrbgems_test.rake into mrbgem.rake 2015-08-22 10:20:15 -04:00
Zachary Scott 383a7d24d3 Move test source code and rake task to mrbgem 2015-08-22 10:18:12 -04:00