Skip to content

Commit

Permalink
tests cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuinox committed Oct 24, 2024
1 parent f4f5e0f commit a6d119d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/Draco.Compiler.Tests/EndToEnd/CodeExecutionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ public void ClassHelloWorld()
var assembly = CompileToAssembly("""
import System.Console;
func main() {
WriteLine("Hello, World!");
}
class Foo {
func bar() {
WriteLine("Hello, World!");
Expand All @@ -28,7 +24,7 @@ func bar() {
""");

var stringWriter = new StringWriter();
_ = Invoke<object?>(assembly: assembly, stdout: stringWriter);
_ = Invoke<object?>(assembly: assembly, stdout: stringWriter, methodName: "bar", moduleName: "FreeFunctions.Foo");

Assert.Equal($"Hello, World!{Environment.NewLine}", stringWriter.ToString(), ignoreLineEndingDifferences: true);
}
Expand All @@ -39,10 +35,10 @@ public void InstanceField()
var assembly = CompileToAssembly("""
import System.Console;
func main() {
func main(): int32 {
var foo = Foo();
foo.increment();
foo.display();
return foo.get();
}
class Foo {
Expand All @@ -51,15 +47,16 @@ public func increment(this) {
this.i += 1;
}
public func display(this) {
WriteLine(this.i);
public func get(this): int32 {
return this.i;
}
}
""");

var stringWriter = new StringWriter();
_ = Invoke<object?>(assembly: assembly, stdout: stringWriter);
var value = Invoke<int>(assembly: assembly, stdout: stringWriter);
Assert.Equal(1, value);

}
}

0 comments on commit a6d119d

Please sign in to comment.