diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 23:55:57 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-09-14 23:55:57 +0200 |
| commit | 04f46bf180cf506ceadb76b5afacf9c02700cc65 (patch) | |
| tree | eee384915f80b8243ff807b239515d1c7525095c /internal | |
| parent | 0b155e8df3205aebf129091b517f4116665a5adc (diff) | |
| download | krino-04f46bf180cf506ceadb76b5afacf9c02700cc65.tar.gz krino-04f46bf180cf506ceadb76b5afacf9c02700cc65.zip | |
build: VERSION checked for build and install, cross names without v, dependency gate covers tests and BSDs, tarball install, examples and extractor list tested
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/engine/examples_test.go | 37 | ||||
| -rw-r--r-- | internal/extract/tools_test.go | 14 |
2 files changed, 51 insertions, 0 deletions
diff --git a/internal/engine/examples_test.go b/internal/engine/examples_test.go new file mode 100644 index 0000000..5f3d8e2 --- /dev/null +++ b/internal/engine/examples_test.go @@ -0,0 +1,37 @@ +// SPDX-License-Identifier: GPL-3.0-or-later + +package engine + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +// TestExamplesLoad: every shipped example directory file loads without a +// diagnostic, so a change to the config language cannot leave the examples +// installed under share/doc/krino broken (triage 34o). +func TestExamplesLoad(t *testing.T) { + examples, err := filepath.Glob(filepath.Join("..", "..", "examples", "*.conf")) + if err != nil || len(examples) == 0 { + t.Fatalf("no examples found: %v", err) + } + for _, ex := range examples { + t.Run(filepath.Base(ex), func(t *testing.T) { + h := sandbox(t) + for _, d := range []string{"Downloads", "Pictures"} { + os.MkdirAll(filepath.Join(h, d), 0o755) + } + body, err := os.ReadFile(ex) + if err != nil { + t.Fatal(err) + } + name := strings.TrimSuffix(filepath.Base(ex), ".conf") + main := writeConfig(t, h, `(include "`+name+`")`, map[string]string{name: string(body)}) + if _, errs := Load(main); len(errs) > 0 { + t.Errorf("%s: %v", ex, errs) + } + }) + } +} diff --git a/internal/extract/tools_test.go b/internal/extract/tools_test.go index 5af80fb..bafb7c2 100644 --- a/internal/extract/tools_test.go +++ b/internal/extract/tools_test.go @@ -280,3 +280,17 @@ func TestToolLookupSkipsRelativePathEntries(t *testing.T) { t.Errorf("tool found through a relative PATH entry: %q", e.tools["pdftotext"]) } } + +// TestMakefileListsEveryTool: `make build` reports missing extractors from +// its own list of tool names; it must be the list Extractor looks up +// (triage 34p). +func TestMakefileListsEveryTool(t *testing.T) { + mk, err := os.ReadFile(filepath.Join("..", "..", "Makefile")) + if err != nil { + t.Fatal(err) + } + want := "for t in " + strings.Join(toolNames, " ") + "; do" + if !strings.Contains(string(mk), want) { + t.Errorf("Makefile's extractor loop is not %q", want) + } +} |
