Add missing test

This commit is contained in:
Richard Feldman 2025-12-03 23:19:53 -05:00
parent f5094c6428
commit 7a934a25f1
No known key found for this signature in database
2 changed files with 24 additions and 0 deletions

View file

@ -1522,3 +1522,19 @@ test "run allows warnings without blocking execution" {
// Should produce output (runs successfully)
try testing.expect(std.mem.indexOf(u8, run_result.stdout, "Hello, World!") != null);
}
test "fx platform method inspect on string" {
// Tests that calling .inspect() on a Str correctly reports MISSING METHOD
// (Str doesn't have an inspect method, unlike custom opaque types)
const allocator = testing.allocator;
const run_result = try runRoc(allocator, "test/fx/test_method_inspect.roc", .{});
defer allocator.free(run_result.stdout);
defer allocator.free(run_result.stderr);
// This should fail because Str doesn't have an inspect method
try checkFailure(run_result);
// Should show MISSING METHOD error
try testing.expect(std.mem.indexOf(u8, run_result.stderr, "MISSING METHOD") != null);
}

8
test_type_error.roc Normal file
View file

@ -0,0 +1,8 @@
app [main!] { pf: platform "test/fx/platform/main.roc" }
import pf.Stdout
main! = || {
x = 42
Stdout.line!(x)
}