Skip to content

Commit

Permalink
Tests for constructor patterns and is check.
Browse files Browse the repository at this point in the history
  • Loading branch information
toinehartman committed Oct 29, 2024
1 parent 2c46676 commit fe7845a
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,27 @@ test bool constructorNameUsedAsVar() = testRenameOccurrences({
'int foo = 8;", {})
});

test bool constructorInPattern() = testRenameOccurrences({0, 1, 2, 3}, "
'Foo f = foo(8);
'if (foo(_) := f) {
' int x = match(f);
'}
", decls = "
'data Foo = foo(int i);
'int match(foo(int i)) = i;
");

test bool constructorIsCheck() = testRenameOccurrences({0, 1, 2, 3}, "
'Foo f = foo(8);
'isFoo(f);
", decls = "
'data Foo
' = foo(int i)
' | foo(int i, int j)
' | baz();
bool isFoo(Foo f) = f is foo;
");

test bool constructorsAndTypesInVModuleStructure() = testRenameOccurrences({
byText("Left", "data Foo = foo();", {0}), byText("Right", "data Foo = foo(int i);", {0})
, byText("Merger",
Expand Down

0 comments on commit fe7845a

Please sign in to comment.