Skip to content

Commit

Permalink
Add tests for intersections
Browse files Browse the repository at this point in the history
  • Loading branch information
drew-y committed Sep 21, 2024
1 parent 0c2a7cc commit 1350163
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/__tests__/compiler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ describe("E2E Compiler Pipeline", () => {
82,
3,
42,
2, // IntersectionType tests
]);
});

Expand Down
12 changes: 12 additions & 0 deletions src/__tests__/fixtures/e2e-file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,18 @@ pub fn test17()
match(x)
Some<i32>: x.value
None: -1
obj Animal { age: i32 }
obj Insect extends Animal { age: i32, legs: i32 }
obj Mammal extends Animal { age: i32, legs: i32 }
fn get_legs(a: Animal & { legs: i32 }) -> i32
a.legs
// Test intersection types
pub fn test18() -> i32
let human = Mammal { age: 10, legs: 2 }
get_legs(human)
`;

export const tcoText = `
Expand Down

0 comments on commit 1350163

Please sign in to comment.