lib9p

Go 9P library.
Log | Files | Refs | LICENSE

stat_test.go (503B)


      1 package lib9p
      2 
      3 import (
      4 	"io/fs"
      5 	"reflect"
      6 	"testing"
      7 )
      8 
      9 func TestStatMarshal(t *testing.T) {
     10 	tests := []struct {
     11 		name string
     12 		stat *Stat
     13 	}{
     14 		{"0", &Stat{}},
     15 		{"1", &Stat{Type: 1, Dev: 2, Qid: Qid{3, 4, 5}, Mode: fs.ModeDir,
     16 			Atime: 6, Mtime: 7, Length: 8, Name: "9",
     17 			Uid: "10", Gid: "11", Muid: "12"}},
     18 	}
     19 	for _, test := range tests {
     20 		got := NewStat(test.stat.marshal())
     21 		if !reflect.DeepEqual(got, test.stat) {
     22 			t.Errorf("%s: got: %v, want: %v", test.name, got, test.stat)
     23 		}
     24 	}
     25 }