test/sandbox: unquote fail messages
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
ad3576c164
commit
d097eaa28f
@ -30,7 +30,7 @@ func printDir(prefix string, dir []fs.DirEntry) {
|
||||
}
|
||||
names[i] = fmt.Sprintf("%q", name)
|
||||
}
|
||||
printf("[FAIL] d %q: %s", prefix, strings.Join(names, " "))
|
||||
printf("[FAIL] d %s: %s", prefix, strings.Join(names, " "))
|
||||
}
|
||||
|
||||
func (s *FS) Compare(prefix string, e fs.FS) error {
|
||||
@ -71,7 +71,7 @@ func (s *FS) Compare(prefix string, e fs.FS) error {
|
||||
if fi, err := got.Info(); err != nil {
|
||||
return err
|
||||
} else if fi.Mode() != want.Mode {
|
||||
printf("[FAIL] m %q: %x, want %x",
|
||||
printf("[FAIL] m %s: %x, want %x",
|
||||
name, uint32(fi.Mode()), uint32(want.Mode))
|
||||
return ErrFSBadMode
|
||||
}
|
||||
|
@ -31,16 +31,16 @@ func TestCompare(t *testing.T) {
|
||||
"[ OK ] s .fortify\x00[ OK ] d .\x00", nil},
|
||||
{"bad length", fstest.MapFS{".fortify": {Mode: 0x800001ed}},
|
||||
&sandbox.FS{Dir: make(map[string]*sandbox.FS)},
|
||||
"[FAIL] d \".\": \".fortify/\"\x00", sandbox.ErrFSBadLength},
|
||||
"[FAIL] d .: \".fortify/\"\x00", sandbox.ErrFSBadLength},
|
||||
{"top level bad mode", fstest.MapFS{".fortify": {Mode: 0x800001ed}},
|
||||
&sandbox.FS{Dir: map[string]*sandbox.FS{".fortify": {Mode: 0xdeadbeef}}},
|
||||
"[FAIL] m \".fortify\": 800001ed, want deadbeef\x00", sandbox.ErrFSBadMode},
|
||||
"[FAIL] m .fortify: 800001ed, want deadbeef\x00", sandbox.ErrFSBadMode},
|
||||
{"invalid entry condition", fstest.MapFS{"test": {Data: []byte{'0'}, Mode: 0644}},
|
||||
&sandbox.FS{Dir: map[string]*sandbox.FS{"test": {Dir: make(map[string]*sandbox.FS)}}},
|
||||
"[FAIL] d \".\": \"test\"\x00", sandbox.ErrFSInvalidEnt},
|
||||
"[FAIL] d .: \"test\"\x00", sandbox.ErrFSInvalidEnt},
|
||||
{"nonexistent", fstest.MapFS{"test": {Data: []byte{'0'}, Mode: 0644}},
|
||||
&sandbox.FS{Dir: map[string]*sandbox.FS{".test": {}}},
|
||||
"[FAIL] d \".\": \"test\"\x00", fs.ErrNotExist},
|
||||
"[FAIL] d .: \"test\"\x00", fs.ErrNotExist},
|
||||
{"file", fstest.MapFS{"etc": {Mode: 0x800001c0},
|
||||
"etc/passwd": {Data: []byte(fsPasswdSample), Mode: 0644},
|
||||
"etc/group": {Data: []byte(fsGroupSample), Mode: 0644},
|
||||
|
Loading…
Reference in New Issue
Block a user