Clean control flow code
This commit is contained in:
parent
519d0cd3a7
commit
150bd2f5cf
13 changed files with 1307 additions and 838 deletions
|
|
@ -23,128 +23,50 @@ mod pretty;
|
|||
/// Add, remove, or edit entries here.
|
||||
/// Using `(&str, &str)` gives each case a human-readable label.
|
||||
const TEST_CASES: &[(&str, &str)] = &[
|
||||
// P0016: invalid initializer start after `for (`
|
||||
// P0022: invalid return value start
|
||||
(
|
||||
"files/P0016_01.uc",
|
||||
"for\n(] ; )",
|
||||
"files/P0022_01.uc",
|
||||
"return ] ;",
|
||||
),
|
||||
(
|
||||
"files/P0016_02.uc",
|
||||
"for (\n ]\n ;\n)\n Body();\n",
|
||||
"files/P0022_02.uc",
|
||||
"return\n ]\n;\n",
|
||||
),
|
||||
(
|
||||
"files/P0016_03.uc",
|
||||
"for (\n }\n ;\n)\n",
|
||||
),
|
||||
(
|
||||
"files/P0016_06.uc",
|
||||
"for (\n ]\n\n\n ; Step)\n",
|
||||
"files/P0022_03.uc",
|
||||
"return\n}\n",
|
||||
),
|
||||
|
||||
// P0017: initializer parsed, but first `;` is missing
|
||||
// P0023: invalid break value start
|
||||
(
|
||||
"files/P0017_01.uc",
|
||||
"for (Init ] ; )",
|
||||
"files/P0023_01.uc",
|
||||
"break ] ;",
|
||||
),
|
||||
(
|
||||
"files/P0017_02.uc",
|
||||
"for (Init\n ]\n ;\n)\n",
|
||||
"files/P0023_02.uc",
|
||||
"break\n \n\n\n\n ]\n;\n",
|
||||
),
|
||||
(
|
||||
"files/P0017_04.uc",
|
||||
"for (Init {\n Body();\n}; )\n",
|
||||
),
|
||||
(
|
||||
"files/P0017_05.uc",
|
||||
"for (Init",
|
||||
"files/P0023_03.uc",
|
||||
"break\n}\n",
|
||||
),
|
||||
|
||||
// P0018: invalid condition start after first `;`
|
||||
// P0024: goto target is missing or not a label token
|
||||
(
|
||||
"files/P0018_01.uc",
|
||||
"for \n\n (; ] ; )",
|
||||
"files/P0024_01.uc",
|
||||
"goto;",
|
||||
),
|
||||
(
|
||||
"files/P0018_02.uc",
|
||||
"for (;\n ]\n ;\n)\n Body();\n",
|
||||
"files/P0024_02.uc",
|
||||
"goto\n ;\n",
|
||||
),
|
||||
(
|
||||
"files/P0018_03.uc",
|
||||
"for (;\n }\n ;\n)\n",
|
||||
"files/P0024_03.uc",
|
||||
"goto\n ]\n;\n",
|
||||
),
|
||||
(
|
||||
"files/P0018_06.uc",
|
||||
"for (;",
|
||||
),
|
||||
|
||||
// P0019: condition parsed, but second `;` is missing
|
||||
(
|
||||
"files/P0019_01.uc",
|
||||
"for (; bCondition )",
|
||||
),
|
||||
(
|
||||
"files/P0019_02.uc",
|
||||
"for (; bCondition\n)\n Body();\n",
|
||||
),
|
||||
(
|
||||
"files/P0019_03.uc",
|
||||
"for (; bCondition ] ; )",
|
||||
),
|
||||
(
|
||||
"files/P0019_04.uc",
|
||||
"for (; bCondition\n{\n Body();\n}\n;\n)\n",
|
||||
),
|
||||
(
|
||||
"files/P0019_06.uc",
|
||||
"for (; bCondition",
|
||||
),
|
||||
(
|
||||
"files/P0019_07.uc",
|
||||
"for (; bCondition Step)",
|
||||
),
|
||||
|
||||
// P0020: invalid step start after second `;`
|
||||
(
|
||||
"files/P0020_01.uc",
|
||||
"for (;;;)",
|
||||
),
|
||||
(
|
||||
"files/P0020_02.uc",
|
||||
"for (;;\n ;\n)\n",
|
||||
),
|
||||
(
|
||||
"files/P0020_03.uc",
|
||||
"for (;; ])",
|
||||
),
|
||||
(
|
||||
"files/P0020_04.uc",
|
||||
"for (;;\n }\n)\n",
|
||||
),
|
||||
(
|
||||
"files/P0020_08.uc",
|
||||
"for (;;\n ]\n",
|
||||
),
|
||||
|
||||
// P0021: missing `)` to close `for` header
|
||||
(
|
||||
"files/P0021_01.uc",
|
||||
"for (;;",
|
||||
),
|
||||
(
|
||||
"files/P0021_02.uc",
|
||||
"for (;; Step",
|
||||
),
|
||||
(
|
||||
"files/P0021_03.uc",
|
||||
"for (;; Step;\n Body();\n",
|
||||
),
|
||||
(
|
||||
"files/P0021_05.uc",
|
||||
"for (Init; bCondition; Step\n{\n Body();\n}\n",
|
||||
),
|
||||
(
|
||||
"files/P0021_09.uc",
|
||||
"for\n(Init;\n bCondition;\n Step\n]\n",
|
||||
"files/P0024_04.uc",
|
||||
"goto",
|
||||
),
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue