Author: fperrad
Date: Mon Dec 8 08:35:03 2008
New Revision: 33658
Modified:
trunk/languages/lua/src/pmc/luanumber.pmc
trunk/languages/lua/t/pmc/number.t
trunk/languages/lua/t/pmc/string.t
Log:
[Lua] box
- test the opcode 'box' with the HLL 'Lua'
- now, LuaNumber PMC maps Float & Integer
Modified: trunk/languages/lua/src/pmc/luanumber.pmc
==============================================================================
--- trunk/languages/lua/src/pmc/luanumber.pmc (original)
+++ trunk/languages/lua/src/pmc/luanumber.pmc Mon Dec 8 08:35:03 2008
@@ -32,6 +32,7 @@
dynpmc
group lua_group
hll Lua
+ maps Integer
maps Float {
/*
Modified: trunk/languages/lua/t/pmc/number.t
==============================================================================
--- trunk/languages/lua/t/pmc/number.t (original)
+++ trunk/languages/lua/t/pmc/number.t Mon Dec 8 08:35:03 2008
@@ -20,7 +20,7 @@
use strict;
use warnings;
-use Parrot::Test tests => 11;
+use Parrot::Test tests => 13;
use Test::More;
pir_output_is( << 'CODE', << 'OUTPUT', 'check inheritance' );
@@ -208,6 +208,42 @@
1
OUTPUT
+pir_output_is( << 'CODE', << 'OUTPUT', 'check box float' );
+.HLL 'Lua'
+.loadlib 'lua_group'
+.sub _main
+ .local pmc pmc1
+ box pmc1, 3.14
+ print pmc1
+ print "\n"
+ .local int bool1
+ bool1 = isa pmc1, 'LuaNumber'
+ print bool1
+ print "\n"
+.end
+CODE
+3.14
+1
+OUTPUT
+
+pir_output_is( << 'CODE', << 'OUTPUT', 'check box integer' );
+.HLL 'Lua'
+.loadlib 'lua_group'
+.sub _main
+ .local pmc pmc1
+ box pmc1, -2
+ print pmc1
+ print "\n"
+ .local int bool1
+ bool1 = isa pmc1, 'LuaNumber'
+ print bool1
+ print "\n"
+.end
+CODE
+-2
+1
+OUTPUT
+
pir_output_is( << 'CODE', << 'OUTPUT', 'check tostring' );
.HLL 'Lua'
.loadlib 'lua_group'
Modified: trunk/languages/lua/t/pmc/string.t
==============================================================================
--- trunk/languages/lua/t/pmc/string.t (original)
+++ trunk/languages/lua/t/pmc/string.t Mon Dec 8 08:35:03 2008
@@ -20,7 +20,7 @@
use strict;
use warnings;
-use Parrot::Test tests => 14;
+use Parrot::Test tests => 15;
use Test::More;
pir_output_is( << 'CODE', << 'OUTPUT', 'check inheritance' );
@@ -213,6 +213,24 @@
1
OUTPUT
+pir_output_is( << 'CODE', << 'OUTPUT', 'check box' );
+.HLL 'Lua'
+.loadlib 'lua_group'
+.sub _main
+ .local pmc pmc1
+ box pmc1, "simple string"
+ print pmc1
+ print "\n"
+ .local int bool1
+ bool1 = isa pmc1, 'LuaString'
+ print bool1
+ print "\n"
+.end
+CODE
+simple string
+1
+OUTPUT
+
pir_output_is( << 'CODE', << 'OUTPUT', 'check is_equal (RT #60292)' );
.HLL 'Lua'
.loadlib 'lua_group'