Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly handle padding in JS2 #660

Merged
merged 9 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions example/js/lib/api/FixedDecimalFormatterOptions.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions example/js/lib/api/diplomat-runtime.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions feature_tests/js/api/BigStructWithStuff.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

101 changes: 101 additions & 0 deletions feature_tests/js/api/BigStructWithStuff.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions feature_tests/js/api/ImportedStruct.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion feature_tests/js/api/MyStruct.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions feature_tests/js/api/ScalarPairWithPadding.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 71 additions & 0 deletions feature_tests/js/api/ScalarPairWithPadding.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions feature_tests/js/api/diplomat-runtime.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions feature_tests/js/api/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions feature_tests/js/api/index.mjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions feature_tests/js/test/struct.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import test from 'ava';
import { MyEnum, MyStruct } from "diplomat-wasm-js-feature-tests";
import { MyEnum, MyStruct, ScalarPairWithPadding, BigStructWithStuff } from "diplomat-wasm-js-feature-tests";

test("Verify invariants of struct", t => {
const s = MyStruct.new_("hello");
Expand All @@ -16,4 +16,16 @@ test("Verify invariants of struct", t => {
test("Test struct creation", t => {
const s = new MyStruct(17, true, 209, 1234n, 5991, '餐'.codePointAt(0), MyEnum.B);
t.is(s.intoA(), 17);
});
});

test("Test struct layout: scalar pair layout", t => {
const s = new ScalarPairWithPadding(122, 414);
s.assertValue();
t.is(true, true); // Ava doesn't like tests without assertions
});

test("Test struct layout: complex struct with multiple padding types and contained scalar pair", t => {
const s = new BigStructWithStuff(101, 505, 9345, new ScalarPairWithPadding(122, 414), 99);
s.assertValue(853);
t.is(true, true); // Ava doesn't like tests without assertions
});
Loading
Loading