Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
67 changes: 67 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
# Matrix: type check + run tests for each backend
moon-check-test:
name: moon check & test (${{ matrix.target }})
strategy:
fail-fast: false
matrix:
target: [wasm, wasm-gc, native]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Set up MoonBit
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> $GITHUB_PATH

- name: MoonBit version & update
run: |
moon version --all
moon update

- name: Type check
run: moon check --target ${{ matrix.target }}

- name: Run tests
run: moon test --target ${{ matrix.target }}

# Formatting check (single job, no matrix needed)
fmt-check:
name: moon fmt --check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- name: Set up MoonBit
run: |
curl -fsSL https://cli.moonbitlang.com/install/unix.sh | bash
echo "$HOME/.moon/bin" >> $GITHUB_PATH

- name: Check formatting
run: moon fmt --check

# Python compliance tests (using local venv)
python-tests:
name: Python compliance tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install dependencies
run: pip install -r tests/python/requirements.txt

- name: Run Python tests
run: python tests/python/compliance_test.py
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ target/
target
.mooncakes/
.moonagent/
.codex/
.codex/
.venv/
__pycache__/
18 changes: 8 additions & 10 deletions README.mbt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OrisGo/nestedtext

[中文](README_zh.mbt.md)

NestedText serialization format parser, emitter, and typed deserialization adapter implemented in MoonBit.

> **Notice**: This project is a MoonBit port of the Rust [nested-text](https://github.com/hansstimer/nested-text) crate. It inherits the Apache-2.0 OR MIT dual license.
Expand Down Expand Up @@ -190,18 +192,12 @@ Parse errors carry location metadata (line number, column, source line).
///|
test "error location" {
match @nestedtext.loads("key: value", @nestedtext.Top::Any) {
Ok(value) => {
match @nestedtext.deserialize_value(
value.unwrap(),
fn(d) { d.expect_int() },
) {
Err(e) => @debug.assert_eq(
e.message,
"expected string, got dictionary",
)
Ok(value) =>
match
@nestedtext.deserialize_value(value.unwrap(), fn(d) { d.expect_int() }) {
Err(e) => @debug.assert_eq(e.message, "expected string, got dictionary")
Ok(_) => fail("expected error")
}
}
Err(e) => fail(e.to_string())
}
}
Expand Down Expand Up @@ -239,6 +235,8 @@ NestedText documents must be valid UTF-8. The `loads` function takes a `String`,

<!-- - Add CLI tool (blocked: MoonBit lacks mature file I/O in stable stdlib). -->

Complete the moon.mod, and release the package. Related Link: https://docs.moonbitlang.com/en/latest/toolchain/moon/module.html

## License

This project is dually licensed under the MIT License and the Apache License, Version 2.0. See `LICENSE`, `LICENSE-MIT`, and `LICENSE-APACHE` for details.
16 changes: 6 additions & 10 deletions README_zh.mbt.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# OrisGo/nestedtext

[English](README.mbt.md)

NestedText 序列化格式的 MoonBit 实现,包含解析器、生成器与类型化反序列化适配器。

> **注意**:本项目是 Rust [nested-text](https://github.com/hansstimer/nested-text) crate 的 MoonBit 移植版,沿用其 Apache-2.0 或 MIT 双许可。
Expand Down Expand Up @@ -190,18 +192,12 @@ test "deserialize optional field" {
///|
test "error location" {
match @nestedtext.loads("key: value", @nestedtext.Top::Any) {
Ok(value) => {
match @nestedtext.deserialize_value(
value.unwrap(),
fn(d) { d.expect_int() },
) {
Err(e) => @debug.assert_eq(
e.message,
"expected string, got dictionary",
)
Ok(value) =>
match
@nestedtext.deserialize_value(value.unwrap(), fn(d) { d.expect_int() }) {
Err(e) => @debug.assert_eq(e.message, "expected string, got dictionary")
Ok(_) => fail("expected error")
}
}
Err(e) => fail(e.to_string())
}
}
Expand Down
Loading
Loading