diff options
Diffstat (limited to 'test_ffi')
| -rw-r--r-- | test_ffi/tests/test.js | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/test_ffi/tests/test.js b/test_ffi/tests/test.js index 0ada7dc0a..e45c5895b 100644 --- a/test_ffi/tests/test.js +++ b/test_ffi/tests/test.js @@ -37,6 +37,40 @@ assertThrows( "Failed to register symbol non_existent_symbol", ); +assertThrows(() => { + Deno.dlopen(libPath, { + print_something: { + parameters: [], + result: { struct: [] } + }, + }), + TypeError, + "Struct must have at least one field" +}); + +assertThrows(() => { + Deno.dlopen(libPath, { + print_something: { + parameters: [ { struct: [] } ], + result: "void", + }, + }), + TypeError, + "Struct must have at least one field" +}); + +const Empty = { struct: [] } +assertThrows(() => { + Deno.dlopen(libPath, { + print_something: { + parameters: [ { struct: [Empty] } ], + result: "void", + }, + }), + TypeError, + "Struct must have at least one field" +}); + const Point = ["f64", "f64"]; const Size = ["f64", "f64"]; const Rect = ["f64", "f64", "f64", "f64"]; @@ -720,4 +754,4 @@ function testOptimized(fn, callback) { console.log(r2); } assertIsOptimized(fn); -}
\ No newline at end of file +} |
