Skip to content

Commit

Permalink
cmds/fmap: cleanup tests (#431)
Browse files Browse the repository at this point in the history
Signed-off-by: Siarhiej Siemianczuk <[email protected]>
  • Loading branch information
binjip978 authored Sep 17, 2024
1 parent b3968fa commit 98cc60b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions cmds/fmap/fmap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/u-root/u-root/pkg/testutil"
)

const testFlash = "fake_test.flash"
const testFlash = "testdata/fake_test.flash"

var tests = []struct {
cmd string
Expand Down Expand Up @@ -64,19 +64,15 @@ func TestFmap(t *testing.T) {
}

// Filter out null characters which may be present in fmap strings.
out = bytes.Replace(out, []byte{0}, []byte{}, -1)
out = bytes.ReplaceAll(out, []byte{0}, []byte{})
if string(out) != tt.out {
t.Errorf("expected:\n%s\ngot:\n%s", tt.out, string(out))
}
}
}

func TestJson(t *testing.T) {
tmpDir, err := os.MkdirTemp("", "fmap_json")
if err != nil {
t.Fatal(err)
}
defer os.RemoveAll(tmpDir)
tmpDir := t.TempDir()

jsonFile := filepath.Join(tmpDir, "tmp.json")
if err := testutil.Command(t, "jget", jsonFile, testFlash).Run(); err != nil {
Expand Down
File renamed without changes.

0 comments on commit 98cc60b

Please sign in to comment.