Skip to content

Commit

Permalink
test: mutable interface assigning
Browse files Browse the repository at this point in the history
  • Loading branch information
R-unic committed Jan 24, 2025
1 parent 1a5a35d commit 30ef63e
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Heir.Tests/VirtualMachineTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,22 @@ public void ThrowsWith(string input, DiagnosticCode expectedDiagnosticCode)
Assert.Contains(vm.Diagnostics, diagnostic => diagnostic.Code == expectedDiagnosticCode);
}

[Fact]
public void Evaluates_MutableInterfaces()
{
const string input = """
interface Foo {
mut bar: string;
}
let foo: Foo = { bar: "baz" };
foo.bar = "YES";
""";

var (value, _) = Evaluate(input);
Assert.Equal("YES", value);
}

[Theory]
[InlineData("math.pi", Math.PI)]
[InlineData("math.e", Math.E)]
Expand Down

0 comments on commit 30ef63e

Please sign in to comment.