Skip to content

Commit

Permalink
chore: add sample test
Browse files Browse the repository at this point in the history
  • Loading branch information
vixalien committed May 26, 2024
1 parent 1f6e717 commit 308c949
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 4 deletions.
37 changes: 35 additions & 2 deletions test/everything/everything.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
import Everything from "https://gir.deno.dev/Everything-1.0";
// import Everything from "https://gir.deno.dev/Everything-1.0";

console.log("Everything", Everything);
import { require } from "../../mod.ts";
import { assertEquals } from "../test_deps.ts";

const Everything = require("Everything", "1.0");

interface GIType {
name: string;
type:
| "bigint"
| "boolean"
| "function"
| "number"
| "object"
| "string"
| "symbol"
| "undefined";
value: unknown;
}

const types: GIType[] = [
{
name: "filename",
type: "string",
value: "hello",
},
];

for (const { name, type, value } of types) {
Deno.test(`const_return_${name}`, () => {
const value = Everything[`const_return_${name}`]();

assertEquals(typeof value, type, `has incorrect return type`);
});
}
4 changes: 2 additions & 2 deletions test/everything/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ test(
'everything',
deno,
args: [
'run',
'-A',
'test',
'--allow-ffi',
'--unstable-ffi',
files('everything.ts')
],
Expand Down

0 comments on commit 308c949

Please sign in to comment.