Skip to content

test(import): cover single-file import, document precedence#32

Closed
zuqini wants to merge 1 commit into
mainfrom
fix/single-file-import-hardening
Closed

test(import): cover single-file import, document precedence#32
zuqini wants to merge 1 commit into
mainfrom
fix/single-file-import-hardening

Conversation

@zuqini

@zuqini zuqini commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Follow-up to #30, which added single-file import (import = 'plugins.foo' resolving lua/plugins/foo.lua, lazy.nvim parity) but landed without tests or docs.

Changes

  • Tests (tests/import_test.lua): single-file resolution (and that it does not walk a same-named directory), file-over-directory precedence, and enabled = false gating on a single-file import.
  • Code comment (lua/zpack/import.lua): makes the file-shadows-directory precedence intentional, mirroring Lua's own require (foo.lua shadows foo/init.lua).
  • Vimdoc (doc/zpack.txt): documents the single-file form and the precedence rule in both the importing-specs section and the Spec.import reference.
  • docs/spec.md: corrected the inline import comment to reflect single-file resolution.

Tradeoffs (recorded, not changed)

  • Double-load: configuring both import = 'plugins' and import = 'plugins.foo' requires foo.lua twice under different keys — harmless (require cache + merge dedup).
  • Path resolution: the existence check is config-dir-only, matching the existing directory walk's pre-existing ceiling.

Verification

  • nvim -u NONE -l tests/busted.lua — 483 passed / 0 failed
  • luacheck lua/ tests/ — 0 warnings / 0 errors

PR #30 added single-file import (import = 'plugins.foo' resolving
lua/plugins/foo.lua) but landed without tests or docs. This adds:

- tests for the single-file path, file-over-directory precedence, and
  enabled=false gating on a single-file import
- a code comment making the file-shadows-directory precedence intentional
- vimdoc (doc/zpack.txt) coverage of the single-file form and precedence
- corrected the import comment in docs/spec.md

Closes zpack_nvim-thi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant