Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 

README.md

Golden Tests

Golden tests verify taskmark parsing and mutation by comparing actual output against expected "golden" files.

Structure

tests/golden/
  parse/                    # Parse tests (50 tests)
    basic/                  # Task states, simple parsing, subtasks
    metadata/               # Projects, tags, assignees, dates, custom fields
    inheritance/            # Heading inheritance, provenance tracking
    multifile/              # File links, circular detection
    realworld/              # Realistic taskmark files

  mutate/                   # Mutation tests (18 tests)
    basic/                  # State changes, field updates
    metadata/               # Tags, assignees, custom fields
    multifile/              # Cross-file mutations
    errors/                 # Error cases
    recurrence/             # Recurring task handling

Parse Tests

Each test is a directory containing:

File Purpose
input.md Markdown file to parse
expected.yaml Expected TaskStore structure
linked_*.md Secondary files (multifile only)
_meta.yaml Test metadata (multifile only)

Example

parse/basic/simple/
  input.md          # - [ ] My task #tag
  expected.yaml     # tasks: [{title: "My task", tags: ["tag"], ...}]

Mutation Tests

Each test is a directory containing:

File Purpose
input.md Starting markdown state
mutation.yaml What to change
expected.md Expected markdown after mutation
linked_*.md Secondary input files (optional)
expected_*.md Expected secondary files (optional)

mutation.yaml Format

target:
  title: "Task title"
  project: "project/path"          # Optional
changes:
  state: done
  tags: ["new-tag"]
expected_result:
  status: success                  # success | partial | fail
options:
  today: "2025-01-15"             # Fixed date for determinism

Example

mutate/basic/mark_done/
  input.md          # - [ ] Fix bug
  mutation.yaml     # state: done
  expected.md       # - [x] 2025-01-15 Fix bug

Running Tests

# Run all golden tests
pytest tests/golden/test_golden.py -v

# Run only parse tests
pytest tests/golden/test_golden.py::test_parse -v

# Run only mutation tests
pytest tests/golden/test_golden.py::test_mutation -v

Adding Tests

Parse Test

  1. Create tests/golden/parse/<category>/<name>/
  2. Add input.md and expected.yaml
  3. Run tests

Mutation Test

  1. Create tests/golden/mutate/<category>/<name>/
  2. Add input.md, mutation.yaml, expected.md
  3. Run tests