diff options
Diffstat (limited to 'website/resources/scripts/testcases2/12.1_Block.json')
-rw-r--r-- | website/resources/scripts/testcases2/12.1_Block.json | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/website/resources/scripts/testcases2/12.1_Block.json b/website/resources/scripts/testcases2/12.1_Block.json new file mode 100644 index 000000000..d4f57a33c --- /dev/null +++ b/website/resources/scripts/testcases2/12.1_Block.json @@ -0,0 +1,41 @@ +{ + "testCollection": { + "name": "12.1_Block", + "numTests": 5, + "tests": [ + { + "section": "12.1", + "description": "Trying to declare function at the Block statement", + "negative": "SyntaxError", + "test": "\"use strict\";\n{\n function __func(){}\n}\n", + "id": "S12.1_A1" + }, + { + "section": "12.1", + "description": "Throwing exception within a Block", + "test": "//////////////////////////////////////////////////////////////////////////////\n//CHECK#1\ntry {\n\tx();\n\t$ERROR('#1: \"x()\" lead to throwing exception');\n} catch (e) {\n\t$PRINT(e.message);\n}\n//\n//////////////////////////////////////////////////////////////////////////////\n\n//////////////////////////////////////////////////////////////////////////////\n//CHECK#2\ntry {\n throw \"catchme\";\t\n $ERROR('#2: throw \"catchme\" lead to throwing exception');\n} catch (e) {\n\tif (e!==\"catchme\") {\n\t\t$ERROR('#2.1: Exception === \"catchme\". Actual: Exception ==='+ e );\n\t}\n}\n\n//\n//////////////////////////////////////////////////////////////////////////////\n", + "id": "S12.1_A2" + }, + { + "section": "12.1", + "description": "Checking if execution of \"y={__func}()\" fails", + "negative": "", + "test": "function __func(){};\n\n//////////////////////////////////////////////////////////////////////////////\n//CHECK#1\ny={__func}();\n//\n//////////////////////////////////////////////////////////////////////////////\n", + "id": "S12.1_A4_T1" + }, + { + "section": "12.1", + "description": "Checking if execution of \"y={x}\" fails", + "negative": "", + "test": "x=1;\n\n//////////////////////////////////////////////////////////////////////////////\n//CHECK#1\ny={x};\n//\n//////////////////////////////////////////////////////////////////////////////\n", + "id": "S12.1_A4_T2" + }, + { + "section": "12.1", + "description": "Throwing exceptions within embedded/sequence Blocks", + "test": "//////////////////////////////////////////////////////////////////////////////\n//CHECK#1\ntry {\n\tthrow 1;\n throw 2;\n throw 3;\n $ERROR('1.1: throw 1 lead to throwing exception');\n} catch (e) {\n\tif (e!==1) {\n\t\t$ERROR('#1.2: Exception === 1. Actual: Exception ==='+ e);\n\t}\n}\n////////////////////////////////////////////////////////////////////////////////\n\n//////////////////////////////////////////////////////////////////////////////\n//CHECK#2\ntry {\n\t{\n\t throw 1;\n throw 2;\n }\n throw 3;\n $ERROR('#2.1: throw 1 lead to throwing exception');\n} catch (e) {\n\tif (e!==1) {\n\t\t$ERROR('#2.2: Exception === 1. Actual: Exception ==='+ e);\n\t}\n}\n////////////////////////////////////////////////////////////////////////////////\n\n//////////////////////////////////////////////////////////////////////////////\n//CHECK#3\ntry {\n\tthrow 1;\n {\n throw 2;\n throw 3;\n }\n $ERROR('#3.1: throw 1 lead to throwing exception');\n} catch (e) {\n\tif (e!==1) {\n\t\t$ERROR('#3.2: Exception === 1. Actual: Exception ==='+ e);\n\t}\n}\n////////////////////////////////////////////////////////////////////////////////\n\n", + "id": "S12.1_A5" + } + ] + } +} |