Skip to content

Commit

Permalink
Squashed 'mruby_test/' changes from ce84e42..cd5133c
Browse files Browse the repository at this point in the history
cd5133c Merge pull request #3205 from yurie/abort-header
028dcfe Merge pull request #3206 from ksss/env
c9d4d96 surpress warning when MRB_DISABLE_STDIO
e66b35c Fix SEGV when unshared env
9040086 Merge pull request #3204 from ksss/mid
a5c2e95 Should clear method name
d58c258 Merge pull request #3202 from pbosetti/master
495545a Merge pull request #3203 from nozomiS/mrbc_filename-fix
068b46d - fix mrbc_filename leak; cxt->filename would not be freed until the state is closed.
ac9b6f2 In mrbgem_spec.rake, added support for @mrblib_dir @objs_dir, so that a gem can have custom source directory names
bf08935 Merge pull request #3192 from ksss/instance_eval
b3236b2 mruby-random: fixed typos
fa76bbe mruby-random: add reporting URL since we modified the source
22dc84f Fixed spell errors in test/t/lang.rb; ref #3199
c313fdf Merge pull request #3199 from miura1729/original
1751d8f Add new test for optimize VM
ff3e4b9 Move Module#include and #prepend to class.c; ref #3197
b2fceae renamed class.rb and error.rb to ensure they are read first; ref #3197
67ad1ff Merge pull request #3198 from nobu/feature/lparen_arg-stmt
73dd82e parse.y: lparen_arg statement
0597f66 Merge pull request #3196 from mimaki/fix-negative-ord
861b0ee Fix String#ord failure which return a negative value
ee40f9b Merge pull request #3195 from franckverrot/master
f6a2f67 Correct method name
8682137 Merge pull request #3194 from nobu/chained-rhs
bdd7e2b parse.y: fix chained assignments
bee34fb Merge pull request #3193 from nobu/rhs-rescue
a06940d parse.y: simplify 90e8ce5
90e8ce5 parse.y: rescue modifiers for OP_ASGN should protect rhs only
ada264a instance_eval env should remake Fix #3191
7a7fac8 removed ChangeLog that has not been updated for long time; ref #3190
af4567b update copyright notice and license description for mt19937ar.[ch]
501e1ef Merge pull request #3189 from wrl/public-hash-values
e02a88e make mrb_hash_values() a public API function
eb7422a Merge pull request #3188 from guoxiao/warning
339005e intptr_t should be used instead of uint32_t to hold a pointer.
42fefef Merge pull request #3186 from rmalizia44/patch-2
1c7572b Update mirb.c
2b4ed40 Merge pull request #3185 from kou/string-reduce-needless-array
6bb0775 Reduce needless Array generation in some String methods
3757b16 Merge pull request #3184 from ksss/each_char
bef63a4 Support to call without block to String#each_char
32ad74f Merge pull request #3182 from sdottaka/fix-broken-msvc-build
e635dc2 Merge pull request #3181 from sdottaka/fix-crash-on-mrb_parser_free
62a1667 Merge pull request #3183 from Mav7/mav7/docs
a66a1e9 Merge pull request #3179 from ksss/struct
34ac707 OP_ASGN vsp may be negative
4170923 Fixed crash error when #initialize is redefined for Struct; fix #3177
189ad47 yard docs for string.h
fb1c4b3 Fix broken msvc build
2eefbfe Fix crash in mrb_parser_free() due to freed memory access
bf21063 Add regression test
1a8074a Should not define to `Struct` class
97283fa Merge pull request #3176 from ksss/string-insert
d83d9cd String#insert should be destructive
72b28f1 Merge pull request #3174 from ksss/local-jump-error
9dc8205 Should raise LocalJumpError when no block given
d4d807b relax string length limitation to 64KB; fix #2725
2e74a93 Merge pull request #3171 from kjunichi/c-has-no-try
f67631a C doesn't have try-catch
0d9aa83 Merge pull request #3169 from ksss/Wshift-negative-value
e3bc81e Fix warning shift-negative-value
3c406d5 Merge pull request #3166 from yyamano/fix-gc-profile
00faf3d Fix compilation error with GC_PROFILE.
fa1c1ab Merge pull request #3163 from mattn/fix-public_methods
8a15ab0 add test for public_methods(false)
8764bd2 fix public_methods(false)
a8af43f Merge pull request #3162 from udzura/patch-1
481aa31 Update doc, write about add_test_dependency
09b1185 mrb_gc_unregister() to remove one registration; close #3160
44de80f fix a compiler warning for uninitialized variable
8dde647 add temporary workaround for irep memory corruption
6b0299f fixed remaining bugs in OP_ASGN stack adjustment; close #3159
29d3a40 stack adjustment after NODE_OP_ASGN with NODE_CALL was wrong; fix #3159
2e81fee parser_dump() to show symbol number for NODE_SYM
5933651 Merge pull request #3157 from cremno/add-mrb_int_mul_overflow
7453a5d use mrb_int_mul_overflow()
6369374 add mrb_int_mul_overflow(); close #3149
0be4b89 Merge pull request #3156 from cremno/fix-mruby_version-value
4fd0cb6 Merge pull request #3154 from cremno/improve-checked-mrb_int-arithmetic-implementation
bc715f9 Merge pull request #3155 from cremno/fix-3152
bf63cff fix MRUBY_VERSION value
309791b raise the error at runtime; fix #3152
7276e84 use type-generic checked arithmetic builtins
39b6a9d define macros only if builtins are n/a
b4e1889 Merge pull request #3153 from kou/remove-needless-assignment
51cc35d Remove needless assignment
ea03352 Merge pull request #3151 from okkez/use-stack-directly
d4ee409 Use stack directly
8f0c1c7 mruby-sprintf:fix double negative signs in printf; fix #3148
c522907 mruby-sprintf: format specifiers o,u,x,b ignore sign(+); ref #3148
e5c2013 Merge pull request #3147 from ksss/1.8
451523f Avoid Syntax Error on CRuby v1.8
fa1a17c Merge pull request #3145 from timoschilling/patch-1
1863f32 fix syntax highlighting
8c67e91 mruby-eval: instance_eval should keep target_class; close #3141
ae5b5ce vm.c: mrb_hash_set() may reallocate VM stack; close #3133
d97a37e fix possible memory leak in mruby-time gem
e1e888e fix too much optimization for `||=`
d098d82 fix duplicated eval in op_asgn
4979b52 reduce OP_ARRAY in argument splat
0e03a7f mruby-enum-ext: refine minmax
4d909d8 Merge pull request #3142 from kou/add-missing-regs-update
c69cba2 Add missing regs update
dd072b5 remove wrong ISO section from safe navigation test; ref 4c1ce0f6
3886bec better code generation for `||=`; #3138
1ce471c `||=` with cvars and constants should work with false values; #3138
4fcff34 `||=` reference error can happen with constants as well; #3138
817b884 add #dig tests
daf8394 add #dig to Array,Hash and Struct
4c1ce0f add safe-navigation operator tests
21a3ae0 add safe-navigation (aka lonely) operator `&.`
7d06125 Merge pull request #3139 from cremno/fix-vs2010-build
30b0100 fix VS2010/2012 build
bfc7b2e deprecate Visual Studio 2010 and 2012
611e99e remove unnecessary array/each
2b0baec fixed silly class variable/constant confusion; #3138
a02acf2 rescue NameError from class variable access like `@@foo ||= 42`; fix #3138
643d967 Merge pull request #3131 from bggd/fix_bintest_on_windows
52d3885 Merge pull request #3132 from pbosetti/edison
273eac6 Merge pull request #3136 from bggd/add_appveyor
51cb729 Create appveyor_config.rb
87e5b0f Add appveyor.yml for Visual Studio 2015/2013
4f20d58 Merge pull request #3135 from wanabe/reduce-include-paths
2aa6b44 Reduce compiler include_paths
a27426a Added example for cross-compiling on Intel Edison
a138ae3 Fix doesn't work bintest on :visualcpp toolchain
41d6ba2 fix dump_prefix() with wrong type argument; fix #3128
0c28c7d change backtrace sep from const char* to char
4e95779 Merge pull request #3125 from zzak/default-benchmark-build-config
b4d946f Merge pull request #3129 from kou/fix-segv-by-backtrace-and-gc
1a4540f Merge pull request #3127 from kou/suppress-warning
f1eb3ae Fix segmentation fault by backtrace and GC
d77c72d Revert "Merge pull request #3126 from jbreeden/backtrace_irep_null_check"
e5cce38 Suppress a warning
bf7719f Merge pull request #3126 from jbreeden/backtrace_irep_null_check
d2a8f7e Fix Travis CI
e02ff85 Null check for irep & initialize loc.lineno
aa90ad5 Add default benchmark build config
4f4fa0a Merge pull request #3121 from asfluido/master
d6cbe1b The original code crashed when mrb->backtrace.n grew to 16. It looks like the logic to reallocate the backtrace was flawed, based on the wrong variable (loc_raw->i, which, as I have verified, decreases from 16 to 0 instead of increasing)
0c23d5a Merge pull request #3120 from rmalizia44/patch-1
52aba8a Avoid Error when Compiling with -std=c99 flag
b8479b6 too many register push for else-less condtions; fix #3117
81acbd2 cosmetic change for OP_EQ
cf5ca03 mruby-struct: copied Struct length is not initialized; fix #3114
819c9da peephole optimization for LOADNIL before STRCAT; ref #3110
d8fc09c push value for NULL AST when value is required; fix #3110
ec35e54 need to free context when reclaiming fiber object in GC; fix #3109
da96c33 syntax error in interpolated symbol; fixed #3108
5596d14 Merge pull request #3107 from mame/fix-enum-hash
683ff0c Merge pull request #3106 from mame/fix-eval-no-filename
a1a157b suppress "can't convert Float into Integer" in Enumerable#hash
668cc1b Fix segfault when `eval("__FILE__")` is executed
74d52a1 Merge pull request #3101 from deuwert/fix-test-build
60c1ed4 Merge pull request #3102 from deuwert/add-limits
299cb5a Fix formatting again...
46fbd53 Add more limitations:   - defined?   - alias on global variables   - Operator modification   - Kernel.binding missing
5976185 Fix bug in mruby-test gem.
37344ec fixed typos in limitations.md
473827d Merge pull request #3100 from deuwert/toolchain-openwrt
f40fc9a Merge pull request #3099 from deuwert/more-limits
fcbaafa Add toolchain support for OpenWRT
e7eb40f Fix formatting
44d26dd Add more limitations
1887042 add 1/2 description to limitations.md file
b3a2d8b Merge pull request #3098 from deuwert/limitations
983948c Small format fix
3bbc486c Add limitation file
62b06ab [cppcheck] mrb_str_rindex() remove unnecessary len update by chars2bytes()
af4dd3d [cppcheck] remove duplicated break
3c73c31 Hash: check flags before accessing ifnone; ref #980
25e4ec3 cache UTF8 status for utf8_strlen(); ref #980
5e514c9 cache mrb_regexp_p(); ref #980
4344ca0 Merge pull request #3096 from hlogmans/master
ed5bf72 Fix missing dependency on mruby-print to support 'puts'

git-subtree-dir: mruby_test
git-subtree-split: cd5133c57065d9645c125c1ce7b5dc4ce6d39bdd
  • Loading branch information
MATSUMOTO Ryosuke committed Sep 8, 2016
1 parent 253323e commit 125a205
Show file tree
Hide file tree
Showing 65 changed files with 1,574 additions and 508 deletions.
15 changes: 0 additions & 15 deletions ChangeLog

This file was deleted.

27 changes: 27 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: "{build}"

os: Visual Studio 2015

clone_depth: 1


environment:
matrix:
# Visual Studio 2015 64bit
- visualcpp: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
machine: amd64

# Visual Studio 2013 64bit
- visualcpp: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
machine: amd64


init:
- call "%visualcpp%" %machine%
# For using bison.exe
- set PATH=%PATH%;C:\cygwin\bin;


build_script:
- set MRUBY_CONFIG=appveyor_config.rb
- ruby .\minirake test
50 changes: 50 additions & 0 deletions appveyor_config.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
MRuby::Build.new('debug') do |conf|
toolchain :visualcpp
enable_debug

# include all core GEMs
conf.gembox 'full-core'
conf.compilers.each do |c|
c.defines += %w(MRB_GC_STRESS MRB_GC_FIXED_ARENA)
end

build_mrbc_exec
end

MRuby::Build.new('full-debug') do |conf|
toolchain :visualcpp
enable_debug

# include all core GEMs
conf.gembox 'full-core'
conf.cc.defines = %w(MRB_ENABLE_DEBUG_HOOK)

conf.enable_test
end

MRuby::Build.new do |conf|
toolchain :visualcpp

# include all core GEMs
conf.gembox 'full-core'
conf.compilers.each do |c|
c.defines += %w(MRB_GC_FIXED_ARENA)
end
conf.enable_bintest
conf.enable_test
end

MRuby::Build.new('cxx_abi') do |conf|
toolchain :visualcpp

conf.gembox 'full-core'
conf.compilers.each do |c|
c.defines += %w(MRB_GC_FIXED_ARENA)
end
conf.enable_bintest
conf.enable_test

enable_cxx_abi

build_mrbc_exec
end
12 changes: 12 additions & 0 deletions build_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,18 @@
conf.gembox 'default'
end

MRuby::Build.new('bench') do |conf|
# Gets set by the VS command prompts.
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
toolchain :visualcpp
else
toolchain :gcc
conf.cc.flags << '-O3'
end

conf.gembox 'default'
end

# Define cross build settings
# MRuby::CrossBuild.new('32bit') do |conf|
# toolchain :gcc
Expand Down
2 changes: 1 addition & 1 deletion doc/guides/compile.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ toolchain :clang
Toolchain configuration for Visual Studio on Windows. If you use the
[Visual Studio Command Prompt](http://msdn.microsoft.com/en-us/library/ms229859\(v=vs.110\).aspx),
you normally do not have to specify this manually, since it gets automatically detected by our build process.
```
```ruby
toolchain :visualcpp
```

Expand Down
3 changes: 3 additions & 0 deletions doc/guides/mrbgems.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ MRuby::Gem::Specification.new('c_and_ruby_extension_example') do |spec|

# Use latest mruby-onig-regexp from github. (version requirements can be omitted)
spec.add_dependency('mruby-onig-regexp', :github => 'mattn/mruby-onig-regexp')

# You can add extra mgems active only on test
spec.add_test_dependency('mruby-process', :github => 'iij/mruby-process')
end
```

Expand Down
208 changes: 208 additions & 0 deletions doc/limitations.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,208 @@
# Limitations and Differences

The philosophy of mruby is to be a lightweight implementation of
the Ruby ISO standard. These two objectives are partially contradicting.
Ruby is an expressive language with complex implementation details which
are difficult to implement in a lightweight manner. To cope with this,
limitations to the "Ruby Compatibility" are defined.

This document is collecting these limitations.

## Integrity

This document does not contain a complete list of limitations.
Please help to improve it by submitting your findings.


## ```1/2``` gives ```0.5```

Since mruby does not have ```Bignum```, bigger integers are represented
by ```Float``` numbers. To enhance interoperability between ```Float```
and ```Float```, mruby provides ``Float#upto``` and other iterating
methods for ```Float`` class. As a side effect, ```1/2``` gives ```0.5```
not ```0```.

## ```Array``` passed to ```puts```

Passing an Array to ```puts``` results in different output.

```ruby
puts [1,2,3]
```

#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

```
1
2
3
```

#### mruby [1.2.0 (2015-11-17)]

```
[1, 2, 3]
```

## ```Kernel.raise``` in rescue clause

```Kernel.raise``` without arguments does not raise the current exception within
a rescue clause.

```ruby
begin
1 / 0
rescue
raise
end
```

#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

```ZeroDivisionError``` is raised.

#### mruby [1.2.0 (2015-11-17)]

No exception is raised.

## Check of infinite recursion

mruby does not check infinite recursion across C extensions.

```ruby
def test; eval 'test'; end; test
```

#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

```SystemStackError``` is raised.

#### mruby [1.2.0 (2015-11-17)]

Segmentation fault.

## Fiber execution can't cross C function boundary

mruby's ```Fiber``` is implemented in a similar way to Lua's co-routine. This
results in the consequence that you can't switch context within C functions.
Only exception is ```mrb_fiber_yield``` at return.

## ```Array``` does not support instance variables

To reduce memory consumption ```Array``` does not support instance variables.

```ruby
class Liste < Array
def initialize(str = nil)
@feld = str
end
end

p Liste.new "foobar"
```

#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

``` [] ```

#### mruby [1.2.0 (2015-11-17)]

```ArgumentError``` is raised.

## Method visibility

For simplicity reasons no method visibility (public/private/protected) is
supported.

```ruby
class VisibleTest

def public_method; end

private
def private_method; end

end

p VisibleTest.new.respond_to?(:private_method, false)
p VisibleTest.new.respond_to?(:private_method, true)
```

#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

```
false
true
```

#### mruby [1.2.0 (2015-11-17)]

```
true
true
```

## defined?

The ```defined?``` keyword is considered to complex to be fully
implemented. It is recommended to use ```const_defined?``` and
other reflection methods instead.

```ruby
defined?(Foo)
```

#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

```
nil
```

#### mruby [1.2.0 (2015-11-17)]

```NameError``` is raised.

## ```alias``` on global variables

Aliasing a global variable works in CRuby but is not part
of the ISO standard.

```ruby
alias $a $__a__
```

#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

``` nil ```

#### mruby [1.2.0 (2015-11-17)]

Syntax error

## Operator modification

An operator can't be overwritten by the user.

```ruby
class String
def +
end
end

'a' + 'b'
```

#### Ruby [ruby 2.0.0p645 (2015-04-13 revision 50299)]

```ArgumentError``` is raised.
The re-defined ```+``` operator does not accept any arguments.

#### mruby [1.2.0 (2015-11-17)]

``` 'ab' ```
Behavior of the operator wasn't changed.

## ```Kernel.binding``` missing

```Kernel.binding``` is not implemented as it is not in the
ISO standard.
2 changes: 2 additions & 0 deletions examples/mrbgems/ruby_extension_example/mrbgem.rake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ MRuby::Gem::Specification.new('ruby_extension_example') do |spec|
# Add libraries
# spec.linker.libraries << 'external_lib'

spec.add_dependency('mruby-print', :core => 'mruby-print')

# Default build files
# spec.rbfiles = Dir.glob("#{dir}/mrblib/*.rb")
# spec.objs = Dir.glob("#{dir}/src/*.{c,cpp,m,asm,S}").map { |f| objfile(f.relative_path_from(dir).pathmap("#{build_dir}/%X")) }
Expand Down

0 comments on commit 125a205

Please sign in to comment.