-
Notifications
You must be signed in to change notification settings - Fork 43
/
regression_test.go
47 lines (36 loc) · 912 Bytes
/
regression_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
package iso9660
import (
"bytes"
"strings"
"testing"
"github.com/stretchr/testify/assert"
)
// Regresstion test for github.com/kdomanski/iso9660/issues/9
func TestRegressionNameWithoutDot(t *testing.T) {
var buf bytes.Buffer
//
// create image with a file without dot
//
w, err := NewWriter()
assert.NoError(t, err)
defer func() {
if cleanupErr := w.Cleanup(); cleanupErr != nil {
t.Fatalf("failed to cleanup writer: %v", cleanupErr)
}
}()
err = w.AddFile(strings.NewReader("hrh2309hr320h"), "NODOT")
assert.NoError(t, err)
err = w.WriteTo(&buf, "testvolume")
assert.NoError(t, err)
//
// no read it
//
image, err := OpenImage(bytes.NewReader(buf.Bytes()))
assert.NoError(t, err)
rootDir, err := image.RootDir()
assert.NoError(t, err)
children, err := rootDir.GetChildren()
assert.NoError(t, err)
nodotfile := children[0]
assert.Equal(t, "nodot", nodotfile.Name())
}