-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove .mjs tests in feature_tests/js, use only .mts files (#750)
* Mark optional types with ? in _Obj in .d.ts * Generation * Using only .mts tests, ignore generated .mjs
- Loading branch information
1 parent
893cf50
commit 1d6942e
Showing
18 changed files
with
56 additions
and
313 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.mjs |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,45 @@ | ||
import test from 'ava'; | ||
|
||
import { OptionOpaque } from "diplomat-wasm-js-feature-tests"; | ||
import { OptionOpaque, OptionEnum, OptionInputStruct } from "diplomat-wasm-js-feature-tests"; | ||
|
||
test("Verify option methods", t => { | ||
const o = OptionOpaque.new_(5); | ||
o!.assertInteger(5); | ||
o.assertInteger(5); | ||
|
||
const on = OptionOpaque.newNone(); | ||
t.assert(on === null); | ||
t.assert(!on); | ||
|
||
const s = OptionOpaque.newStruct(); | ||
|
||
s.a!.assertInteger(101); | ||
s.b!.assertChar('餐'.codePointAt(0)); | ||
t.is(s.c!, 904); | ||
s.d!.assertInteger(926535); | ||
s.a.assertInteger(101); | ||
s.b.assertChar('餐'.codePointAt(0)); | ||
t.is(s.c, 904); | ||
s.d.assertInteger(926535); | ||
|
||
const sn = OptionOpaque.newStructNones(); | ||
t.assert(!sn.a); | ||
t.assert(!sn.b); | ||
t.is(sn.c, 908); | ||
t.assert(!sn.d); | ||
}); | ||
|
||
test("DiplomatOption tests", t => { | ||
let maybeU8 = OptionOpaque.acceptsOptionU8(null); | ||
t.assert(maybeU8 === null); | ||
maybeU8 = OptionOpaque.acceptsOptionU8(47); | ||
t.is(maybeU8, 47); | ||
|
||
let maybeStruct = OptionOpaque.acceptsOptionInputStruct(null); | ||
t.assert(maybeStruct === null); | ||
maybeStruct = OptionOpaque.acceptsOptionInputStruct(new OptionInputStruct({a: 7, c: OptionEnum.Bar})); | ||
t.is(maybeStruct.a, 7); | ||
t.assert(maybeStruct.b === null); | ||
t.is(maybeStruct.c.value, OptionEnum.Bar.value); | ||
|
||
|
||
let struct = OptionOpaque.returnsOptionInputStruct(); | ||
t.is(struct.a, 6); | ||
t.assert(struct.b === null); | ||
t.is(struct.c.value, OptionEnum.Bar.value); | ||
|
||
}); |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.