CI & Build / Python lint (push) Successful in 2s
CI & Build / Build now, or wait for Android? (push) Successful in 3s
Android / Build, or is the channel already serving this? (push) Successful in 3s
Desktop (Tauri) / Build, or is the channel already serving this? (push) Successful in 1s
CI & Build / Web typecheck and unit tests (push) Successful in 9s
CI & Build / Python tests (push) Failing after 12s
CI & Build / integration (push) Failing after 27s
CI & Build / Build & push image (push) Skipped
Desktop (Tauri) / Web tests, clippy, Rust tests and rustfmt (push) Successful in 4m25s
Desktop (Tauri) / Windows installer (cross-compiled) (push) Successful in 3m28s
Desktop (Tauri) / Tauri desktop (Linux) (push) Successful in 4m19s
Desktop (Tauri) / Update manifest (push) Successful in 9s
Android / Kotlin + Rust (APK) (push) Canceled after 11m21s
The checklist grammar and the #tag rule are implemented three times (derive.rs, checklist.py/tags.py, markdown.ts), and the tag colour twice (colors.ts, DerivedTint.kt). Only Rust and Kotlin had tests. core/testdata/grammar.json now holds one set of cases (task lines, rendered items, tags, standalone-tag lifts and the tint hashes), and every suite reads it. - web: vitest, a dev dependency approved for #5166, with `npm test`. grammar.test.ts runs the fixture, and titles.test.ts pins #5165's palette fix. - ci.yml runs the web tests in the job the image build needs. desktop.yml's verify job runs them too, because the installers embed this frontend and can't see ci.yml's verdict (rule 177). - core: derive.rs reads the fixture. server: tests/test_grammar_fixture.py. - Android keeps its hand-written tint values; its doc now points at the fixture. The server is expected red here, on purpose. tags.py only takes a tag after whitespace and lets it start with a digit or `_`, while the core (the definition) takes any non-tag boundary and needs a letter. So `(#todo)` is a label on the phone and plain text on the server. The fix follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.6 KiB
Python
44 lines
1.6 KiB
Python
"""The server's half of the shared grammar fixture (core/testdata/grammar.json).
|
|
|
|
The same cases run against the core (derive.rs) and the web (markdown.ts). A case
|
|
that passes in one language and fails in another is a note that changes shape when
|
|
it syncs — a checklist that stops being one, or a tag that is a label on the phone
|
|
and plain text on the server.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
import json
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
from inkwell.notes.checklist import parse_items, render_item
|
|
from inkwell.notes.tags import parse_tags, split_body_tags
|
|
|
|
FIXTURE = json.loads(
|
|
(Path(__file__).resolve().parents[1] / "core" / "testdata" / "grammar.json").read_text(encoding="utf-8")
|
|
)
|
|
|
|
|
|
@pytest.mark.parametrize("case", FIXTURE["task_lines"], ids=lambda c: repr(c["line"]))
|
|
def test_task_lines(case):
|
|
got = [(i.text, i.checked) for i in parse_items(case["line"])]
|
|
want = [] if case["item"] is None else [(case["item"]["text"], case["item"]["checked"])]
|
|
assert got == want
|
|
|
|
|
|
@pytest.mark.parametrize("case", FIXTURE["rendered_items"], ids=lambda c: repr(c["line"]))
|
|
def test_rendered_items(case):
|
|
assert render_item(case["text"], case["checked"]) == case["line"]
|
|
|
|
|
|
@pytest.mark.parametrize("case", FIXTURE["tags"], ids=lambda c: repr(c["body"]))
|
|
def test_tags(case):
|
|
assert parse_tags(case["body"]) == case["tags"]
|
|
|
|
|
|
@pytest.mark.parametrize("case", FIXTURE["lifts"], ids=lambda c: repr(c["body"]))
|
|
def test_lifts(case):
|
|
standalone, inline, lifted = split_body_tags(case["body"])
|
|
assert (standalone, inline, lifted) == (case["standalone"], case["inline"], case["lifted"])
|