diff options
Diffstat (limited to 'internal/engine')
| -rw-r--r-- | internal/engine/engine.go | 6 | ||||
| -rw-r--r-- | internal/engine/exclude_test.go | 7 |
2 files changed, 12 insertions, 1 deletions
diff --git a/internal/engine/engine.go b/internal/engine/engine.go index 7a83ccd..00a249d 100644 --- a/internal/engine/engine.go +++ b/internal/engine/engine.go @@ -93,8 +93,12 @@ func Load(mainFile string, names ...string) (*Engine, []*config.Diag) { // With no directory to compile them for, krino.conf's excludes are // still checked, so a mistake is reported before one is included // (review cli F10). + // Compiled with the defaults' case and fold, as a directory without + // settings of its own would compile them (triage 28g). + def := cfg.Main.Defaults.Over(config.Builtin()) + opt := cond.Options{IgnoreCase: def.Case == config.CaseIgnore, Fold: def.Fold} for _, x := range cfg.Main.Excludes { - _, cerrs := cond.Compile(cfg.Main.File, x.When, cond.Options{IgnoreCase: true, Fold: true}) + _, cerrs := cond.Compile(cfg.Main.File, x.When, opt) errs = append(errs, cerrs...) } } diff --git a/internal/engine/exclude_test.go b/internal/engine/exclude_test.go index cd1cc4b..8308a82 100644 --- a/internal/engine/exclude_test.go +++ b/internal/engine/exclude_test.go @@ -261,6 +261,13 @@ func TestLoadChecksMainExcludesWithoutDirectories(t *testing.T) { if _, errs := Load(main); len(errs) == 0 { t.Error("a broken krino.conf exclude was not reported") } + // Checked with the defaults' case and fold, as a directory would compile + // them (triage 28g): a keyword of a lone combining mark is empty only + // when folded. + main = writeConfig(t, h, "(include)\n(defaults (fold no))\n(exclude (content \"\u0301\"))\n", nil) + if _, errs := Load(main); len(errs) != 0 { + t.Errorf("checked with fold on, though the defaults say no: %v", errs) + } } // TestNoTextFormatIsNoMatch: a file whose format has no text cannot contain |
