Skip to content

Commit

Permalink
Add bug testcase for GH-2019
Browse files Browse the repository at this point in the history
  • Loading branch information
svaarala committed Jun 30, 2019
1 parent d22c5cd commit 870b138
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions tests/ecmascript/test-bug-plus-coercion-gh2019.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
/*
* https://github.com/svaarala/duktape/issues/2019
*/

/*===
NaN
NaN
0
Infinity
0
-Infinity
0
NaN
NaN
0
Infinity
0
-Infinity
0
NaN
NaN
0
-Infinity
0
Infinity
0
NaN
NaN
0
-Infinity
0
Infinity
0
done
===*/

try {
print(+'+');
print(+'-');
print(+'+0');
print(1 / +'+0');
print(+'-0');
print(1 / +'-0');
print(+'');

print(+' + ');
print(+' - ');
print(+' +0 ');
print(1 / +' +0 ');
print(+' -0 ');
print(1 / +' -0 ');
print(+' ');

print(-'+');
print(-'-');
print(-'+0');
print(1 / -'+0');
print(-'-0');
print(1 / -'-0');
print(-'');

print(-' + ');
print(-' - ');
print(-' +0 ');
print(1 / -' +0 ');
print(-' -0 ');
print(1 / -' -0 ');
print(-' ');
} catch (e) {
print(e.stack || e);
}

print('done');

0 comments on commit 870b138

Please sign in to comment.