1
0
mirror of https://github.com/go-task/task.git synced 2025-05-13 22:16:31 +02:00

fix: fuzzy model was not instanciated (#2200)

* fix: fuzzy model was not instanciated

* add test

* add test
This commit is contained in:
Valentin Maerten 2025-04-28 01:00:54 +02:00 committed by GitHub
parent 1c35358fcc
commit a33544101a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 30 additions and 1 deletions

View File

@ -937,3 +937,24 @@ func TestVarInheritance(t *testing.T) {
)
}
}
func TestFuzzyModel(t *testing.T) {
t.Parallel()
NewExecutorTest(t,
WithName("fuzzy"),
WithExecutorOptions(
task.WithDir("testdata/fuzzy"),
),
WithTask("instal"),
WithRunError(),
)
NewExecutorTest(t,
WithName("not-fuzzy"),
WithExecutorOptions(
task.WithDir("testdata/fuzzy"),
),
WithTask("install"),
)
}

View File

@ -95,7 +95,7 @@ func (e *Executor) readTaskfile(node taskfile.Node) error {
}
func (e *Executor) setupFuzzyModel() {
if e.Taskfile != nil {
if e.Taskfile == nil {
return
}

4
testdata/fuzzy/Taskfile.yml vendored Normal file
View File

@ -0,0 +1,4 @@
version: 3
tasks:
install: echo 'install'

View File

@ -0,0 +1 @@
task: Task "instal" does not exist. Did you mean "install"?

View File

@ -0,0 +1 @@
task: No tasks with description available. Try --list-all to list all tasks

View File

@ -0,0 +1,2 @@
task: [install] echo 'install'
install