aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormax99x <max99x@gmail.com>2011-06-27 20:34:33 +0300
committermax99x <max99x@gmail.com>2011-06-27 20:34:33 +0300
commitbb908423d386f5f28e452b301daa3fb758707de1 (patch)
tree4c4bb88fa0b101d0be5bc4626793ab3bc52c54b8
parente3ec8e15ee32adf9296a6dcc18bfb88bd2ab3d7f (diff)
Fixed unsigned number printing; updated Lua test with correct format (same as GCC produces).
-rw-r--r--src/library.js5
-rw-r--r--tests/runner.py2
2 files changed, 4 insertions, 3 deletions
diff --git a/src/library.js b/src/library.js
index 19970840..8a0b4993 100644
--- a/src/library.js
+++ b/src/library.js
@@ -193,7 +193,8 @@ var Library = {
if (next == 'd'.charCodeAt(0) || next == 'i'.charCodeAt(0)) {
argText = currAbsArg.toString(10);
} else if (next == 'u'.charCodeAt(0)) {
- argText = unSign(currAbsArg, 32).toString(10);
+ argText = unSign(currArg, 32).toString(10);
+ currArg = Math.abs(currArg);
} else if (next == 'o'.charCodeAt(0)) {
argText = (flagAlternative ? '0' : '') + currAbsArg.toString(8);
} else if (next == 'x'.charCodeAt(0)) {
@@ -331,7 +332,7 @@ var Library = {
fractionPart += '0';
}
}
- if (dropTrailingZeros) {
+ if (fractionPart.length && dropTrailingZeros) {
while (fractionPart[fractionPart.length - 1] == '0') {
fractionPart = fractionPart.slice(0, -1);
}
diff --git a/tests/runner.py b/tests/runner.py
index 302078a6..414f5308 100644
--- a/tests/runner.py
+++ b/tests/runner.py
@@ -2150,7 +2150,7 @@ if 'benchmark' not in sys.argv:
global INIT_STACK; INIT_STACK = 1 # TODO: Investigate why this is necessary
self.do_ll_test(path_from_root('tests', 'lua', 'lua.ll'),
- 'hello lua world!\n17.00000000000\n1.00000000000\n2.00000000000\n3.00000000000\n4.00000000000\n7.00000000000',
+ 'hello lua world!\n17\n1\n2\n3\n4\n7',
args=['-e', '''print("hello lua world!");print(17);for x = 1,4 do print(x) end;print(10-3)'''],
output_nicerizer=lambda string: string.replace('\n\n', '\n').replace('\n\n', '\n'))