| <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> |
| <html> |
| <head> |
| <script src="../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <script> |
| |
| description("This test checks toString() round-trip decompilation for binary and unary operators."); |
| |
| var tests = [ |
| "x + + y", |
| "x + - y", |
| "x - + y", |
| "x - - y", |
| "x * + y", |
| "x * - y", |
| "x / + y", |
| "x / - y", |
| "x % + y", |
| "x % - y", |
| "x++ + y", |
| "x++ - y", |
| "x++ * y", |
| "x++ / y", |
| "x-- + y", |
| "x-- - y", |
| "x-- * y", |
| "x-- / y", |
| "x + ++y", |
| "x - ++y", |
| "x * ++y", |
| "x / ++y", |
| "x + --y", |
| "x - --y", |
| "x * --y", |
| "x / --y", |
| "x++ + ++y", |
| "x++ - ++y", |
| "x++ * ++y", |
| "x++ / ++y", |
| "x-- + ++y", |
| "x-- - ++y", |
| "x-- * ++y", |
| "x-- / ++y", |
| "x++ + --y", |
| "x++ - --y", |
| "x++ * --y", |
| "x++ / --y", |
| "x-- + --y", |
| "x-- - --y", |
| "x-- * --y", |
| "x-- / --y", |
| "+ + x", |
| "+ - x", |
| "- + x", |
| "- - x", |
| "1", |
| "-1", |
| "- -1", |
| "- - 0", |
| "- - NaN" |
| ]; |
| |
| for (test in tests) { |
| var decompiledFunction = eval("(function () { " + tests[test] + ";})").toString().replace(/\n/g, ""); |
| shouldBe("decompiledFunction", "'function () { " + tests[test] + ";}'"); |
| } |
| </script> |
| <script src="../../resources/js-test-post.js"></script> |
| </body> |
| </html> |