Merge new change

This commit is contained in:
Daniel Bovensiepen
2012-11-08 17:23:51 +09:00
34 changed files with 284 additions and 197 deletions
+34 -1
View File
@@ -18,6 +18,13 @@ ASSLIB := $(BASEDIR)/assert.rb
MRBS := $(BASEDIR)/t/*.rb
OBJS := driver.o $(MLIB)
# for mruby/mrbc test
REPLIB := $(BASEDIR)/report.rb
TESTRB := mrubytest.rb
TESTMRB := mrubytest.mrb
TESTRB_REP := mrubytest.rb.report
TESTMRB_REP := mrubytest.mrb.report
# libraries, includes
LIBS = -lm
INCLUDES = -I$(BASEDIR)/../src -I$(BASEDIR)/../include
@@ -44,19 +51,37 @@ endif
# mruby compiler and test driver
ifeq ($(OS),Windows_NT)
<<<<<<< HEAD
MRBC = ../bin/mrbc.exe
EXE := $(TARGET).exe
else
MRBC = ../bin/mrbc
EXE := $(TARGET)
=======
MRBC = ../bin/mrbc.exe
MRUBY= ../bin/mruby.exe
EXE := $(TARGET).exe
else
MRBC = ../bin/mrbc
MRUBY= ../bin/mruby
EXE := $(TARGET)
>>>>>>> upstream/master
endif
##############################
# generic build targets, rules
.PHONY : test
all : $(EXE)
all : $(EXE) $(MRUBY) $(TESTRB) $(TESTMRB)
@echo "# exec mrbtest"
./$(EXE)
@echo
@echo "# exec mruby test with ruby script"
@($(MRUBY) $(TESTRB) > $(TESTRB_REP) && echo "mrubytest.rb success.") || $(CAT) $(TESTRB_REP)
@echo
@echo "# exec mruby test with mrb file"
@($(MRUBY) -b $(TESTMRB) > $(TESTMRB_REP) && echo "mrubytest.mrb success.") || $(CAT) $(TESTMRB_REP)
@echo
# executable constructed using linker from object files
$(EXE) : $(OBJS) $(LIBR)
@@ -80,8 +105,16 @@ $(DLIB) : $(RLIB) $(MRBC)
$(RLIB) : $(ASSLIB) $(MRBS)
$(CAT) $(ASSLIB) $(MRBS) > $@
# Compile mrb file from mruby source
$(TESTMRB) : $(MRBC) $(TESTRB)
$(MRBC) $(TESTRB)
$(TESTRB) : $(ASSLIB) $(MRBS) $(REPLIB)
$(CAT) $(ASSLIB) $(MRBS) $(REPLIB) > $@
# clean up
.PHONY : clean
clean :
@echo "make: removing targets, objects and depend files of `pwd`"
-$(RM_F) $(MLIB) $(CLIB) $(RLIB) $(DLIB) $(DEPLIB) $(OBJS) $(EXE)
-$(RM_F) $(TESTRB) $(TESTMRB) $(TESTRB_REP) $(TESTMRB_REP)
+1 -1
View File
@@ -32,7 +32,7 @@ check_error(mrb_state *mrb)
mrb_value ko_test = mrb_gv_get(mrb, mrb_intern(mrb, "$ko_test"));
mrb_value kill_test = mrb_gv_get(mrb, mrb_intern(mrb, "$kill_test"));
return FIXNUM_P(ko_test) && mrb_fixnum(ko_test) == 0 && FIXNUM_P(kill_test) && mrb_fixnum(kill_test) == 0;
return mrb_fixnum_p(ko_test) && mrb_fixnum(ko_test) == 0 && mrb_fixnum_p(kill_test) && mrb_fixnum(kill_test) == 0;
}
int
+4
View File
@@ -0,0 +1,4 @@
report
if $ko_test > 0 or $kill_test > 0
raise "mrbtest failed (KO:#{$ko_test}, Crash:#{$kill_test})"
end
+17
View File
@@ -339,3 +339,20 @@ assert('Check the usage of a NUL character') do
"qqq\0ppp"
end
assert('String#bytes') do
str1 = "hello"
bytes1 = [104, 101, 108, 108, 111]
str1.bytes == bytes1
end
assert('String#each_byte') do
str1 = "hello"
bytes1 = [104, 101, 108, 108, 111]
bytes2 = []
str1.each_byte {|b| bytes2 << b }
bytes1 == bytes2
end
+13
View File
@@ -45,3 +45,16 @@ assert('Abbreviated variable assignment', '11.4.2.3.2') do
c += 2
a == 1 and b == nil and c == 3
end
assert('Nested const reference') do
module Syntax4Const
CONST1 = "hello world"
class Const2
def const1
CONST1
end
end
end
Syntax4Const::CONST1 == "hello world" and
Syntax4Const::Const2.new.const1 == "hello world"
end