495 Commits

Author SHA1 Message Date
mimaki 22464fe5a0 mruby-1.2.0 2015-11-17 18:02:30 +09:00
cremno bb141e5532 fix ambiguous first argument warning
/home/travis/build/mruby/mruby/test/t/float.rb:201:17:
ambiguous first argument; put parentheses or even spaces
2015-11-06 18:35:19 +01:00
Yukihiro "Matz" Matsumoto 6b3fd18262 clarify asserts to UTF-8 test suites; ref #2971 2015-10-01 19:32:29 +09:00
Yasuhiro Matsumoto 7ad75a4a19 fix tests 2015-09-30 13:08:11 +09:00
Yasuhiro Matsumoto d5f145076c chop with utf-8. fix #2967 2015-09-29 21:22:45 +09:00
Yukihiro "Matz" Matsumoto 798ec3aff4 UTF-8 string support in core
define MRB_UTF8_STRING (in mrbconf.h) to enable UTF-8 support.
2015-09-24 02:37:33 +09:00
Yukihiro "Matz" Matsumoto 6a06a3e48d String#rindex should no longer take integer argument 2015-09-23 01:06:26 +09:00
takahashim f1c23a0f75 support String#[]= with 3 args 2015-09-16 18:50:03 +09:00
Yukihiro "Matz" Matsumoto 698b3c925d add Hash#rehash to handle key modification; ref #2945 2015-09-10 23:03:53 +09:00
Yukihiro "Matz" Matsumoto 8bb7962eb8 Merge branch 'module-prepend' of https://github.com/polyfox/mruby into polyfox-module-prepend 2015-09-04 04:01:49 +09:00
Yukihiro "Matz" Matsumoto c6aa87c837 Merge pull request #2924 from zzak/mruby-test
Extract mrbtest to binary gem
2015-09-03 00:43:21 +09:00
Yukihiro "Matz" Matsumoto 3a462fe468 Integer << and >> to use Float instead of raising RangeError 2015-09-02 23:41:51 +09:00
Zachary Scott 87564dc98f Make travis happy
We have do this because mruby's test files are found using MRUBY_ROOT, like this:
    mrbs = Dir.glob("#{MRUBY_ROOT}/test/t/*.rb")
2015-09-02 09:56:27 -04:00
Yukihiro "Matz" Matsumoto 74696ffd96 Float << and >> should be more compatible to Fixnum 2015-09-02 22:29:01 +09:00
Jun Hiroe 69e835cd0f Add String#freeze test 2015-08-27 21:44:56 +09:00
Blaž Hrastnik 78462c9181 Clean up tests 2015-07-13 23:46:41 +02:00
Blaž Hrastnik 8c4da7accd assert() cannot be nested 2015-07-13 23:38:37 +02:00
Blaž Hrastnik 8c13e2b7c6 Set origin when doing kind_of? comparisons 2015-07-13 23:35:30 +02:00
Blaž Hrastnik b0fb9ccfd8 Enable test_prepend_module_ancestors because it seems to pass. 2015-07-13 23:25:01 +02:00
Corey Powell 11cb41770d Space out test_prepend_super_in_alias assert
Also tried to fix it, however the problem lies with how aliased methods
are done and their internal structure.

mruby simply aliases methods by grabbing the RProc and giving it a new name,
super then determines the original method to call by using the name

so a method called m, aliased as m2, will call the m2 super method instead of m
2015-07-13 10:45:57 -05:00
Blaž Hrastnik 11dad71578 Enable visibility prepend tests again 2015-07-13 14:04:43 +02:00
Corey Powell 47264bf289 Ported all MRI prepend tests
And of course, some of them fail miserably
2015-07-13 14:04:42 +02:00
Corey Powell 319553f0ef Removed some debug prints from the test 2015-07-13 14:04:42 +02:00
Corey Powell 99aff17075 Ported a bit more of the MRI Module#prepend tests over
Currently kind_of fails miserably, still looking for the reason
2015-07-13 14:04:42 +02:00
Blaž Hrastnik d046814d8b Rename classes because of conflicts 2015-07-13 14:04:42 +02:00
Blaž Hrastnik f962890a92 Implement Module#prepend. 2015-07-13 14:04:42 +02:00
cremno f0eaf9eaf5 fix arity of lambdas with optional arguments
From the CRuby 2.2.2 Proc#arity documentation:

If the block has optional arguments, returns -n-1, where n is the number
of mandatory arguments, with the exception for blocks that are not
lambdas and have only a finite number of optional arguments; in this
latter case, returns n.
2015-06-22 13:34:24 +02:00
Tomoyuki Sahara 5dd2b8e16f gsub/sub supports back references in substitutes. fixes #2816.
This implementation is compatible with CRuby's String#gsub/sub
except \1 ... \9 and \+.  They are useless without Regexp library.
2015-06-08 17:32:14 +09:00
cremno 5cd877be7f fix masgn nosplat array rhs bug
The rest lhs variable has to be an empty array if rhs is an array with
less elements than pre + post lhs variables. The codegen generated
OP_ARRAY with an invalid length (such as 127 for *a, b = []) because rn
was negative.
2015-05-31 13:30:49 +02:00
Yukihiro "Matz" Matsumoto 9ef4bbb10d update test/t/syntax.rb to success on CRuby 2015-05-31 18:29:26 +09:00
Yukihiro "Matz" Matsumoto 8dd6b0fd09 Merge branch 'failing-multiple-assignments-with-rest-tests' of https://github.com/cremno/mruby into cremno-failing-multiple-assignments-with-rest-tests 2015-05-31 17:02:45 +09:00
cremno 59ea323976 check if outer is a class or module
For modules this check didn't exist yet. Also call #inspect.
2015-05-29 14:58:53 +02:00
cremno ba3a0c22a5 add multiple assignment with rest tests 2015-05-29 12:17:13 +02:00
cremno 2aa59393ba fix splat without assignment; fix #2781
The parser generates NODE_NIL for tSTAR without argument in masgns. The
codegen didn't handle that.
2015-05-07 16:58:43 +02:00
Miura Hideki eb3af3752f Fix to avoid warning 2015-04-17 20:04:07 +09:00
Miura Hideki a21d3f627e Add test of negative arguments for Integer#% 2015-04-17 17:26:12 +09:00
Kouhei Sutou 4b4ddd5a28 Fix a bug that no expression case doesn't return valid value
Here is a script that reproduces this problem:

     x = case
         when true; 1
         end
     p x # => main # 1 is expected
2015-02-24 20:53:12 +09:00
Kouhei Sutou 584d6de3c2 Fix a bug that if and no return value case can't return true clause value
Here is a script that reproduce this problem:

     x = if true
           1
         else
           case 2
           when 3
           end
           4
         end
     p x # => nil # 1 is expected
2015-02-24 00:16:41 +09:00
Kouhei Sutou 8cb40fcda7 Fix ensure with yield context on break and return
How to reproduce:

    class A
      def x
        yield
      ensure
        y
      end

      def y
      end
    end

    # Work
    A.new.x do
    end

    # Not work
    # trace:
    # 	[2] /tmp/a.rb:5:in A.x
    # 	[0] /tmp/a.rb:15
    # /tmp/a.rb:5: undefined method 'y' for main (NoMethodError)
    A.new.x do
      break
    end

    # trace:
    # 	[2] /tmp/a.rb:5:in A.call
    # 	[0] /tmp/a.rb:19
    # /tmp/a.rb:5: undefined method 'y' for main (NoMethodError)
    lambda do
      A.new.x do
        return
      end
    end.call

`self` in ensure is broken when yield and break/return are used.
2015-02-05 22:40:25 +09:00
Kouhei Sutou 5ec676aa37 Fix splat and multiple assignments
Case1: From variable

Code:

    a = [1, 2, 3, 4, 5]
    b, c, *d = a

    p [a, b, c, d]

Before:

    [[1, 2, 3, 4, 5], 1, 2, []]

After:

    [[1, 2, 3, 4, 5], 1, 2, [3, 4, 5]]

Ruby:

    [[1, 2, 3, 4, 5], 1, 2, [3, 4, 5]]

Case2: From variables

Code:

    a = [1, 2, 3]
    b = [4, 5, 6, 7]
    c, d, *e, f, g = *a, *b

    p [a, b, c, d, e, f, g]

Before:

    [[1, 2, 3], [4, 5, 6, 7], 1, 2, [], 6, 7]

After:

    [[1, 2, 3], [4, 5, 6, 7], 1, 2, [3, 4, 5], 6, 7]

Ruby:

    [[1, 2, 3], [4, 5, 6, 7], 1, 2, [3, 4, 5], 6, 7]

Case 3: "for"

Code:

    a = [1, 2, 3, 4, 5, 6, 7]
    for b, c, *d, e, f in [a] do
      p [a, b, c, d, e, f]
    end

Before:

    [[1, 2, 3, 4, 5, 6, 7], 1, 2, [], nil, nil]

After:

    [[1, 2, 3, 4, 5, 6, 7], 1, 2, [3, 4, 5], 6, 7]

Ruby:

    [[1, 2, 3, 4, 5, 6, 7], 1, 2, [3, 4, 5], 6, 7]
2014-12-23 21:16:01 +09:00
h2so5 05b00a14c5 String#[] should reject nil index 2014-12-17 14:01:39 +09:00
Yukihiro "Matz" Matsumoto bcf8ad87e6 add multiple assignment decomposition test 2014-11-27 16:21:48 +09:00
Robert Mosolgo 0133d9ac70 fix(String) String#[] accepts float; close #2650 #2651 2014-11-26 01:03:38 +09:00
Yukihiro "Matz" Matsumoto 69ba4f0ed5 instance_methods etc should not include undef'ed method names; based on a patch from @cremno; fix #2613 2014-10-20 11:11:26 +09:00
Tatsuhiko Kubo bd6dc0da77 Add test for Numeric#pow. 2014-08-25 17:18:24 +09:00
Tatsuhiko Kubo 2b283393c6 Remove empty lines. 2014-08-20 12:07:36 +09:00
Kouhei Sutou e75e2083fd Fix a bug that class variable can't be referenced from class method
Class method defined in singleton class should be evaluated in class
context not singleton class context.

fix #2515
2014-08-09 15:06:17 +09:00
dreamedge 0b8a0f4bb4 add Module#module_function 2014-07-18 09:50:54 +09:00
Yukihiro "Matz" Matsumoto ba0ddb7819 fix conflict resolution mistake 2014-06-19 01:55:39 +09:00
Yukihiro "Matz" Matsumoto a47cc0c211 resolve conflict 2014-06-18 23:44:24 +09:00