refactor: unify how executor tests are written (#2042)

* feat: use TaskTest for executor tests

* feat: more tests

* feat: separate tests for executing and formatting with new functional options that work for both test types

* feat: formatter tests

* refactor: more tests
This commit is contained in:
Pete Davison
2025-03-31 17:53:58 +01:00
committed by GitHub
parent 180fcef364
commit 4736bc2734
175 changed files with 1706 additions and 1111 deletions

View File

@@ -1 +0,0 @@
*.txt

View File

@@ -12,33 +12,33 @@ tasks:
GERMAN: "Welt!"
deps:
- task: write-file
vars: {CONTENT: Dependence1, FILE: dep1.txt}
vars: {CONTENT: Dependence1}
- task: write-file
vars: {CONTENT: Dependence2, FILE: dep2.txt}
vars: {CONTENT: Dependence2}
- task: write-file
vars: {CONTENT: "{{.SPANISH|replace \"mundo\" \"dependencia\"}}", FILE: spanish-dep.txt}
vars: {CONTENT: "{{.SPANISH|replace \"mundo\" \"dependencia\"}}"}
cmds:
- task: write-file
vars: {CONTENT: Hello, FILE: hello.txt}
vars: {CONTENT: Hello}
- task: write-file
vars: {CONTENT: "$echo 'World'", FILE: world.txt}
vars: {CONTENT: "$echo 'World'"}
- task: write-file
vars: {CONTENT: "!", FILE: exclamation.txt}
vars: {CONTENT: "!"}
- task: write-file
vars: {CONTENT: "{{.SPANISH}}", FILE: spanish.txt}
vars: {CONTENT: "{{.SPANISH}}"}
- task: write-file
vars: {CONTENT: "{{.PORTUGUESE}}", FILE: portuguese.txt}
vars: {CONTENT: "{{.PORTUGUESE}}"}
- task: write-file
vars: {CONTENT: "{{.GERMAN}}", FILE: german.txt}
vars: {CONTENT: "{{.GERMAN}}"}
- task: non-default
write-file:
cmds:
- echo {{.CONTENT}} > {{.FILE}}
- echo {{.CONTENT}}
non-default:
vars:
PORTUGUESE: "{{.PORTUGUESE_HELLO_WORLD}}"
cmds:
- task: write-file
vars: {CONTENT: "{{.PORTUGUESE}}", FILE: portuguese2.txt}
vars: {CONTENT: "{{.PORTUGUESE}}"}

1
testdata/params/dep1.txt vendored Normal file
View File

@@ -0,0 +1 @@
Dependence1

1
testdata/params/dep2.txt vendored Normal file
View File

@@ -0,0 +1 @@
Dependence2

1
testdata/params/exclamation.txt vendored Normal file
View File

@@ -0,0 +1 @@
!

1
testdata/params/german.txt vendored Normal file
View File

@@ -0,0 +1 @@
Welt!

1
testdata/params/hello.txt vendored Normal file
View File

@@ -0,0 +1 @@
Hello

1
testdata/params/portuguese.txt vendored Normal file
View File

@@ -0,0 +1 @@
Olá, mundo!

1
testdata/params/portuguese2.txt vendored Normal file
View File

@@ -0,0 +1 @@
Olá, mundo!

1
testdata/params/spanish-dep.txt vendored Normal file
View File

@@ -0,0 +1 @@
¡Holla dependencia!

1
testdata/params/spanish.txt vendored Normal file
View File

@@ -0,0 +1 @@
¡Holla mundo!

View File

@@ -0,0 +1,10 @@
!
Dependence1
Dependence2
Hello
Olá, mundo!
Olá, mundo!
Welt!
World
¡Holla dependencia!
¡Holla mundo!

1
testdata/params/world.txt vendored Normal file
View File

@@ -0,0 +1 @@
World