moon update
python -m pip install -r examples/telemetry/requirements.txt
python examples/schema_compat/peer.py prepare work/schema-compat
moon run --target js examples/schema_compat -- work/schema-compat
python examples/schema_compat/peer.py verify work/schema-compatVerified MoonBit output: generics, AnyPointer, constants, schema evolution and union/group transitions| Existing declaration | Input and independently checked output |
|---|---|
| TestUseGenerics.basic | TestGenerics(TestAllTypes, TestAnyPointer) retains concrete field types; reversed bindings and a list of nested generic structs round-trip |
| TestUseGenerics.inner2 | Ancestor Bar binding, local Baz=Text, bound inner scope and unbound inner scope keep their distinct meanings |
| unspecified, bindEnumList | Unbound parameter carries Text through AnyPointer; a bound enum list preserves known ordinals 0/7 and unknown ordinal 40000 in both directions |
| Generic defaults and aliases | Unwritten fields expose 123, "text", 321, [12,34] and [12,34,56] from the original schema |
| TestAnyPointer | Struct, Int32 list, UTF-8 Text, arbitrary Data and null are interpreted and copied without dropping unknown content |
| TestAnyOthers | AnyStruct and AnyList use their constrained views; a null capability remains null |
| genericConstant, anyPointerConstants, embeddedStruct | Generated constant functions produce real messages that Python/C++ decodes and checks |
| embeddedData, embeddedText | Generated values match Python/C++ constants and original embedded files byte for byte, including the Text file's final newline |
| CodeGeneratorRequest | Both peers check Node, Brand.scopeId, each bound Type.typeId, and AnyPointer-backed Value against the original schema declarations |
| TestOldVersion, TestNewVersion | An old writer is read with new recursive defaults (987, "baz") in both languages; MoonBit forwards a new message through the older typed view, and Python verifies the unknown root and child extension fields survive |
| TestOldUnionVersion, TestNewUnionVersion | Existing a/b alternatives retain their meanings when a becomes a nested union group; Python reads the MoonBit nested alternative through both old and new views |
| TestUnionInUnion, TestInterleavedGroups | Nested union reinitialization resets its tag and value; switching or clearing one interleaved group preserves the other group's data, pointers and tag |
| TestUnion viewed through TestOldUnionVersion | A legal C++-built tag 4 is unknown to the smaller view: both implementations reject its known members, MoonBit exposes the raw tag and forwards the complete payload without loss |
moon build --target native --release cmd/capnpc-moonbit
capnp compile --no-standard-import -Ifixtures/upstream/capnproto-1.5.0 --src-prefix=fixtures/upstream/capnproto-1.5.0 -o./_build/native/release/build/cmd/capnpc-moonbit/capnpc-moonbit.exe:tests/generated/upstream fixtures/upstream/capnproto-1.5.0/capnp/test.capnp
capnp compile --no-standard-import -Ifixtures/upstream/capnproto-1.5.0 --src-prefix=fixtures/upstream/capnproto-1.5.0 -o./_build/native/release/build/cmd/capnpc-moonbit/capnpc-moonbit.exe:tests/generated/compiler fixtures/upstream/capnproto-1.5.0/capnp/schema.capnp
moon fmt
git diff --exit-code -- tests/generated/upstream tests/generated/compilerInstall
Download zipCap'n Proto serialization runtime and schema code generation for MoonBit.