Files
slides/internal/process/execute_test.go
Mark Stenglein de9baaf976 EXECUTE: TEST: Use more common sed instead of sd
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.
2021-06-27 22:15:39 -04:00

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)
}
})
}
}