Skip to content

Commit 1cb750c

Browse files
committed
Update playground test
1 parent f75fbf0 commit 1cb750c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

playground/playground_test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ let result = compiler.rescript.compile(`
1313
module A = {
1414
@react.component
1515
let make = (~a) => {
16+
// This should yield a warning (unused variable state)
1617
let state = React.useState(() => 0)
1718
<div> {React.string(a)} </div>
1819
}
@@ -46,7 +47,7 @@ if(result.js_code != "") {
4647
console.log('----');
4748
if(result.type === "unexpected_error") {
4849
console.log("UNEXPECTED ERROR");
49-
console.log(result.msg);
50+
console.log(result);
5051
process.exit(1);
5152
}
5253
if(result.errors && result.errors.length > 0) {
@@ -56,6 +57,13 @@ if(result.js_code != "") {
5657
}
5758
process.exit(1);
5859
}
60+
61+
if(result.warnings.length === 0) {
62+
console.log("TEST FAILED");
63+
console.log("The code should have at least one warning.");
64+
process.exit(1);
65+
}
66+
5967
console.log(result.js_code);
6068
console.log('-- Playground test complete --');
6169
}

0 commit comments

Comments
 (0)