Index: test/webkit/fast/js/function-decompilation-operators.js |
diff --git a/test/webkit/ignored-result-ref-crash.js b/test/webkit/fast/js/function-decompilation-operators.js |
similarity index 52% |
copy from test/webkit/ignored-result-ref-crash.js |
copy to test/webkit/fast/js/function-decompilation-operators.js |
index d2deea2a8d5c6a72b4f17b9fe7f8aa1e9c3de2ee..759767f88e4e30fe7670fa62c8cfb01e00b315c5 100644 |
--- a/test/webkit/ignored-result-ref-crash.js |
+++ b/test/webkit/fast/js/function-decompilation-operators.js |
@@ -21,66 +21,63 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-description( |
-"This tests that bytecode code generation doesn't crash when it encounters odd cases of an ignored result." |
-); |
+description("This test checks toString() round-trip decompilation for binary and unary operators."); |
-function emptyStatementDoWhileTest() |
-{ |
- do |
- ; |
- while (false) { } |
- return true; |
-} |
+ 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" |
+ ]; |
-shouldBeTrue("emptyStatementDoWhileTest()"); |
- |
-function debuggerDoWhileTest() |
-{ |
- do |
- debugger; |
- while (false) { } |
- return true; |
-} |
- |
-shouldBeTrue("debuggerDoWhileTest()"); |
- |
-function continueDoWhileTest() |
-{ |
- var i = 0; |
- do |
- i++; |
- while (i < 10) { |
- do |
- continue; |
- while (false) { } |
- } |
- return true; |
-} |
- |
-shouldBeTrue("continueDoWhileTest()"); |
- |
-function breakDoWhileTest() |
-{ |
- var i = 0; |
- do |
- i++; |
- while (i < 10) { |
- do |
- continue; |
- while (false) { } |
- } |
- return true; |
-} |
- |
-shouldBeTrue("breakDoWhileTest()"); |
- |
-function tryDoWhileTest() |
-{ |
- do |
- try { } catch (o) { } |
- while (false) { } |
- return true; |
-} |
- |
-shouldBeTrue("tryDoWhileTest()"); |
+ for (test in tests) { |
+ var decompiledFunction = eval("(function () { " + tests[test] + ";})").toString().replace(/\n/g, ""); |
+ shouldBe("decompiledFunction", "'function () { " + tests[test] + ";}'"); |
+ } |