Author: fperrad
Date: Fri Dec 12 07:19:10 2008
New Revision: 33832
Modified:
trunk/languages/lua/src/lib/complex.pir
trunk/languages/lua/t/complex.t
Log:
[Lua] complex
- fix __unm
Modified: trunk/languages/lua/src/lib/complex.pir
==============================================================================
--- trunk/languages/lua/src/lib/complex.pir (original)
+++ trunk/languages/lua/src/lib/complex.pir Fri Dec 12 07:19:10 2008
@@ -221,8 +221,9 @@
.param pmc z :optional
.param pmc extra :slurpy
$P1 = get(1, z)
- $P0 = new $P1
- .tailcall newcomplex($P0)
+ $P0 = neg $P1
+ $P0 = newcomplex($P0)
+ .return ($P0)
.end
Modified: trunk/languages/lua/t/complex.t
==============================================================================
--- trunk/languages/lua/t/complex.t (original)
+++ trunk/languages/lua/t/complex.t Fri Dec 12 07:19:10 2008
@@ -22,7 +22,7 @@
use FindBin;
use lib "$FindBin::Bin";
-use Parrot::Test tests => 25;
+use Parrot::Test tests => 26;
use Parrot::Config;
use Test::More;
use Parrot::Test::Lua;
@@ -85,6 +85,14 @@
/^[^:]+: [^:]+:\d+: bad argument #1 to 'real' \(number expected, got
string\)\nstack traceback:\n/
OUTPUT
+language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'complex __unm' );
+require 'complex'
+z = complex.new(3, 4)
+print(-z)
+CODE
+-3-4i
+OUTPUT
+
language_output_is( 'lua', << 'CODE', << 'OUTPUT', 'function abs' );
require 'complex'
z = complex.new(3, 4)