Skip to content

Commit

Permalink
update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Chriscbr committed Jul 20, 2023
1 parent c33d2fd commit 0516603
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
5 changes: 3 additions & 2 deletions examples/tests/invalid/file_with_variables.w
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ let x = 5;
let y = ["hello", "world"];
let z = new cloud.Bucket();

class Bar {}
class Bar {
x: num;
}

throw("dummy error");
3 changes: 3 additions & 0 deletions examples/tests/valid/bring_local.w
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
bring "./store.w" as file1;
bring "./subdir/subfile.w" as file2;
bring "./subdir/empty.w" as file3;

// classes from other files can be used
let store = new file1.Store();
let q = new file2.Q();

test "add data to store" {
store.store("foo");
Expand Down
Empty file.
1 change: 1 addition & 0 deletions examples/tests/valid/subdir/subfile.w
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
class Q {}
14 changes: 6 additions & 8 deletions tools/hangar/__snapshots__/invalid.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -627,14 +627,12 @@ Duration <DURATION>"
`;
exports[`file_with_variables.w 1`] = `
"ERROR: dummy error
../../../examples/tests/invalid/target/test/file_with_variables.wsim.023247.tmp/.wing/preflight.js:34
const y = Object.freeze([\\"hello\\", \\"world\\"]);
const z = this.node.root.newAbstract(\\"@winglang/sdk.cloud.Bucket\\",this,\\"cloud.Bucket\\");
>> {((msg) => {throw new Error(msg)})(\\"dummy error\\")};
}
}
"error: Preflight field \\"x\\" is not initialized
--> ../../../examples/tests/invalid/file_with_variables.w:10:3
|
10 | x: num;
| ^ Preflight field \\"x\\" is not initialized
Expand Down

0 comments on commit 0516603

Please sign in to comment.