Skip to content

Commit

Permalink
e2e: implement platform specific tests
Browse files Browse the repository at this point in the history
yassinebenaid committed Jan 20, 2025
1 parent 249fd20 commit cf43b59
Showing 2 changed files with 38 additions and 0 deletions.
6 changes: 6 additions & 0 deletions bunster_test.go
Original file line number Diff line number Diff line change
@@ -7,6 +7,7 @@ import (
"os/exec"
"path"
"path/filepath"
"runtime"
"strings"
"testing"

@@ -23,6 +24,7 @@ import (
type Test struct {
Cases []struct {
Name string `yaml:"name"`
RunsOn string `yaml:"runs_on"`
Env []string `yaml:"env"`
Args []string `yaml:"args"`
Files map[string]string `yaml:"files"`
@@ -74,6 +76,10 @@ func TestBunster(t *testing.T) {
// we support filtering, someone would want to run specific tests.
continue
}
if testCase.RunsOn != "" && testCase.RunsOn != runtime.GOOS {
// some tests only run on spesific platforms.
continue
}
testsHasRan++

workdir, err := setupWorkdir()
32 changes: 32 additions & 0 deletions tests/01-redirections.yml
Original file line number Diff line number Diff line change
@@ -160,6 +160,38 @@ cases:
stdout: "foo\n"

- name: "cannot write to a file open for reading, and vise-versa"
runs_on: linux
files:
"file.txt": "Hello World"
script: |
# file open for reading only.
echo foobar 3<file.txt >&3
# here string is only intended for reading only.
echo foobar 3<<<foobar >&3
# file open for writing only.
cat 3>file2.txt <&3
# file open for appending only.
cat 3>>file2.txt <&3
# file open for writing only.
cat 3>|file2.txt <&3
expect:
exit_code: 1
stderr: |
echo: write error: Bad file descriptor
echo: write error: Bad file descriptor
cat: -: Bad file descriptor
cat: -: Bad file descriptor
cat: -: Bad file descriptor
files:
"file.txt": "Hello World"
"file2.txt": ""

- name: "cannot write to a file open for reading, and vise-versa"
runs_on: darwin
files:
"file.txt": "Hello World"
script: |

0 comments on commit cf43b59

Please sign in to comment.