Skip to content

test(learn): cover the learn module's progress and workspace lifecycle#819

Merged
Chemaclass merged 1 commit into
mainfrom
test/learn-progress-unit-tests
Jul 16, 2026
Merged

test(learn): cover the learn module's progress and workspace lifecycle#819
Chemaclass merged 1 commit into
mainfrom
test/learn-progress-unit-tests

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

src/learn.sh (1.2k lines, 82 functions) was the only module with no tests at all — a static gap scan of public functions vs test references surfaced it.

💡 Changes

  • New tests/unit/learn_test.sh covering the non-interactive core: progress persistence (mark_completed/is_completed roundtrip, exact lesson matching, accumulation, absent file) and the init/cleanup workspace lifecycle.
  • Each test sources learn.sh in a fresh shell with HOME sandboxed (the progress-file path is a readonly bound at source time), so the user's real progress file is never touched and the tests are parallel-safe.

src/learn.sh (1.2k lines, 82 functions) had no tests at all. Cover its
non-interactive core: mark_completed/is_completed persistence (roundtrip,
exact-match so lesson_1 does not shadow lesson_10, accumulation, absent
progress file) and init/cleanup workspace lifecycle (including cleanup
without init).

LEARN_PROGRESS_FILE is a readonly resolved from $HOME at source time, so each
test sources learn.sh in a fresh shell with HOME pointed at a sandbox — the
user's real progress file is never touched, and the tests are parallel-safe.
@Chemaclass Chemaclass added the enhancement New feature or request label Jul 16, 2026
@Chemaclass Chemaclass self-assigned this Jul 16, 2026
@Chemaclass
Chemaclass merged commit bf09712 into main Jul 16, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the test/learn-progress-unit-tests branch July 16, 2026 05:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant