mirror of
https://github.com/maaslalani/slides.git
synced 2026-01-10 06:48:01 -05:00
This patch updates the `sd Find Replace` test case to make use of `sed` instead of `sd`. This should help tests pass on a wider range of systems without introducing a testing dependency.
39 lines
603 B
Go
39 lines
603 B
Go
package process
|
|
|
|
import "testing"
|
|
|
|
func TestExecute(t *testing.T) {
|
|
tt := []struct {
|
|
block Block
|
|
want string
|
|
}{
|
|
{
|
|
block: Block{
|
|
Command: "cat",
|
|
Input: "Hello, world!",
|
|
},
|
|
want: "Hello, world!",
|
|
},
|
|
{
|
|
block: Block{
|
|
Command: "sed -e s/Find/Replace/g",
|
|
Input: "Find",
|
|
},
|
|
want: "Replace",
|
|
},
|
|
}
|
|
|
|
for _, tc := range tt {
|
|
t.Run(tc.want, func(t *testing.T) {
|
|
if testing.Short() {
|
|
t.SkipNow()
|
|
}
|
|
tc.block.Execute()
|
|
got := tc.block.Output
|
|
if tc.want != got {
|
|
t.Fatalf("Invalid execution, want %s, got %s", tc.want, got)
|
|
}
|
|
})
|
|
}
|
|
}
|