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" {
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" {
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 "can't walk from a file" {
33 mount(0, "/")
35 walk(0, 1, "dir", "a-file")
36 expect(Rwalk)
38 walk(1, 2, "subdir", "file")
39 expect-error()
40 }
42 testing "walk with invalid fid" {
43 mount(0, "/")
44 walk(1, 2)
45 expect-error()
46 }
48 testing "walk with empty string" {
49 mount(0, "/")
50 walk(0, 1, "")
51 expect-error()
52 }
54 testing "walk to a non-existant file" {
55 mount(0, "/")
56 walk(0, 1, "non-exists")
57 expect-error()
58 }
60 testing "walk with an invalid component" {
61 mount(0, "/")
62 walk(0, 1, "/non-exists")
63 expect-error()
64 }
66 testing "zero-path walk don't reply with a qid" {
67 mount(0, "/")
68 walk(0, 1)
69 m = recv()
70 assert (
71 m.type == Rwalk
72 m.nwqid == 0
73 )
74 }