Skip to content

Commit

Permalink
test: add an additional test
Browse files Browse the repository at this point in the history
  • Loading branch information
TrickyPi committed Apr 14, 2023
1 parent 19873df commit 4b68421
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/function/samples/switch-break/_config.js
@@ -0,0 +1,4 @@
module.exports = {
description: 'preserve break if switch does not always throw an error',
solo: true
};
19 changes: 19 additions & 0 deletions test/function/samples/switch-break/main.js
@@ -0,0 +1,19 @@
function issue(obj) {
switch (obj.field1) {
case 'baz':
switch (obj.field2) {
case 'value': {
if (obj.field1) {
break;
}
throw new Error(`error 1`);
}
default:
throw new Error(`error 2`);
}
break;
default:
throw new Error('error 3');
}
}
issue({ field1: 'baz', field2: 'value' });

0 comments on commit 4b68421

Please sign in to comment.