mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge branch 'master' of github.com:mruby/mruby
This commit is contained in:
+1
-1
@@ -286,7 +286,7 @@ mrb_range_beg_len(mrb_state *mrb, mrb_value range, mrb_int *begp, mrb_int *lenp,
|
|||||||
if (end > len) end = len;
|
if (end > len) end = len;
|
||||||
}
|
}
|
||||||
if (end < 0) end += len;
|
if (end < 0) end += len;
|
||||||
if (!r->excl) end++; /* include end point */
|
if (!r->excl && end < len) end++; /* include end point */
|
||||||
len = end - beg;
|
len = end - beg;
|
||||||
if (len < 0) len = 0;
|
if (len < 0) len = 0;
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -671,7 +671,7 @@ retry:
|
|||||||
tmp = mrb_check_string_type(mrb, val);
|
tmp = mrb_check_string_type(mrb, val);
|
||||||
if (!mrb_nil_p(tmp)) {
|
if (!mrb_nil_p(tmp)) {
|
||||||
if (RSTRING_LEN(tmp) != 1 ) {
|
if (RSTRING_LEN(tmp) != 1 ) {
|
||||||
mrb_raise(mrb, E_ARGUMENT_ERROR, "%%c requires a character");
|
mrb_raise(mrb, E_ARGUMENT_ERROR, "%c requires a character");
|
||||||
}
|
}
|
||||||
c = RSTRING_PTR(tmp)[0];
|
c = RSTRING_PTR(tmp)[0];
|
||||||
n = 1;
|
n = 1;
|
||||||
|
|||||||
+3
-4
@@ -34,14 +34,13 @@ end
|
|||||||
assert('Module#class_variables', '15.2.2.4.19') do
|
assert('Module#class_variables', '15.2.2.4.19') do
|
||||||
class Test4ClassVariables1
|
class Test4ClassVariables1
|
||||||
@@var1 = 1
|
@@var1 = 1
|
||||||
@@var2 = 2
|
|
||||||
end
|
end
|
||||||
class Test4ClassVariables2 < Test4ClassVariables1
|
class Test4ClassVariables2 < Test4ClassVariables1
|
||||||
@@var3 = 2
|
@@var2 = 2
|
||||||
end
|
end
|
||||||
|
|
||||||
Test4ClassVariables1.class_variables == [:@@var1, :@@var2] &&
|
Test4ClassVariables1.class_variables == [:@@var1] &&
|
||||||
Test4ClassVariables2.class_variables == [:@@var3]
|
Test4ClassVariables2.class_variables == [:@@var2]
|
||||||
end
|
end
|
||||||
|
|
||||||
assert('Module#const_defined?', '15.2.2.4.20') do
|
assert('Module#const_defined?', '15.2.2.4.20') do
|
||||||
|
|||||||
@@ -61,6 +61,32 @@ assert('String#[]', '15.2.10.5.6') do
|
|||||||
a3 == 'bc' and b3 == nil
|
a3 == 'bc' and b3 == nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
assert('String#[] with Range') do
|
||||||
|
a1 = 'abc'[1..0]
|
||||||
|
b1 = 'abc'[1..1]
|
||||||
|
c1 = 'abc'[1..2]
|
||||||
|
d1 = 'abc'[1..3]
|
||||||
|
e1 = 'abc'[1..4]
|
||||||
|
f1 = 'abc'[0..-2]
|
||||||
|
g1 = 'abc'[-2..3]
|
||||||
|
h1 = 'abc'[3..4]
|
||||||
|
i1 = 'abc'[4..5]
|
||||||
|
a2 = 'abc'[1...0]
|
||||||
|
b2 = 'abc'[1...1]
|
||||||
|
c2 = 'abc'[1...2]
|
||||||
|
d2 = 'abc'[1...3]
|
||||||
|
e2 = 'abc'[1...4]
|
||||||
|
f2 = 'abc'[0...-2]
|
||||||
|
g2 = 'abc'[-2...3]
|
||||||
|
h2 = 'abc'[3...4]
|
||||||
|
i2 = 'abc'[4...5]
|
||||||
|
|
||||||
|
a1 == '' and b1 == 'b' and c1 == 'bc' and d1 == 'bc' and e1 == 'bc' and
|
||||||
|
f1 == 'ab' and g1 == 'bc' and h1 == '' and i2 == nil and
|
||||||
|
a2 == '' and b2 == '' and c2 == 'b' and d2 == 'bc' and e2 == 'bc' and
|
||||||
|
f2 == 'a' and g2 == 'bc' and h2 == '' and i2 == nil
|
||||||
|
end
|
||||||
|
|
||||||
assert('String#capitalize', '15.2.10.5.7') do
|
assert('String#capitalize', '15.2.10.5.7') do
|
||||||
a = 'abc'
|
a = 'abc'
|
||||||
a.capitalize
|
a.capitalize
|
||||||
|
|||||||
Reference in New Issue
Block a user