summaryrefslogtreecommitdiffhomepage
path: root/test/t/vformat.rb
AgeCommit message (Collapse)Author
2020-10-12Integrate `Fixnum` class into `Integer` classdearblue
* The `Fixnum` constant is now an alias for the `Integer` class. * Remove `struct mrb_state::fixnum_class` member. If necessary, use `struct mrb_state::integer_class` instead.
2019-12-19Reimplement `vformat` tests; close #4868Yukihiro "Matz" Matsumoto
Avoid creating `Data` object that refers `mruby` objects. Also close #4622 ref #4613
2019-12-19Revert "`%C` value need not to be saved in `TestVFormat::Native`; close #4868"Yukihiro "Matz" Matsumoto
This reverts commit f507ff4842b92a60c0c600fa1f29efdf2688c877. It makes AppVeyor tests fail.
2019-12-18`%C` value need not to be saved in `TestVFormat::Native`; close #4868Yukihiro "Matz" Matsumoto
2019-08-03Change second argument to `%l` of `mrb_vformat()` to `size_t` from `mrb_int`KOBAYASHI Shuji
- `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-03Fix `mrb_vformat("%f")` with `MRB_USE_FLOAT`KOBAYASHI Shuji
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-02Change the `mrb_vformat` specifier `%d` for `int`KOBAYASHI Shuji
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-01Add new specifiers/modifiers to format string of `mrb_vfromat()`KOBAYASHI Shuji
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.