Skip to content

Commit

Permalink
ensure the implementation check the content
Browse files Browse the repository at this point in the history
make sure the validation does not happen after the looping the generator
  • Loading branch information
FrankYFTang authored Sep 15, 2021
1 parent e012f28 commit 28751c0
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,13 @@ const fields = {
i++;
yield "monthCode";
i++;
// The fourth one is wrong
// The fourth one is wrong and should throw after the next line.
yield "garbage";
// The following three lines should not be reached if the implemention
// correctly check the previous line.
i++;
yield "hour";
i++;
}
}
assert.throws(RangeError, () => cal.fields(fields), "Garbage content");
Expand Down

0 comments on commit 28751c0

Please sign in to comment.