Blob


1 include "lib.9ps"
3 # TODO: add a test that tries to do a walk after opening a fid for i/o.
5 testing "walk to a directory" dir "./root" {
6 mount(0, "/")
7 walk(0, 1, "dir", "subdir")
9 m = recv()
10 assert (
11 m.type == Rwalk
12 m.nwqid == 2
13 m.wqid.0.type == QTDIR
14 m.wqid.1.type == QTDIR
15 )
16 }
18 testing "walk to a file" dir "./root" {
19 mount(0, "/")
20 walk(0, 1, "dir", "subdir", "file")
22 m = recv()
23 assert (
24 m.type == Rwalk
25 m.nwqid == 3
26 m.wqid.0.type == QTDIR
27 m.wqid.1.type == QTDIR
28 m.wqid.2.type == QTFILE
29 )
30 }
32 testing "walk with invalid fid" dir "./root" {
33 mount(0, "/")
34 walk(1, 2)
35 expect-error()
36 }
38 testing "walk with empty string" dir "./root" {
39 mount(0, "/")
40 walk(0, 1, "")
41 expect-error()
42 }
44 testing "walk to a non-existant file" dir "./root" {
45 mount(0, "/")
46 walk(0, 1, "non-exists")
47 expect-error()
48 }
50 testing "walk with an invalid component" dir "./root" {
51 mount(0, "/")
52 walk(0, 1, "/non-exists")
53 expect-error()
54 }