class test resolver
class test store
public test store(string path prefix, boolean is current)
super(path prefix, is current, is current)
override boolean exists(immutable list[string] path)
return false
override string read string(immutable list[string] path)
return "test"
override void write string(immutable list[string] path, string new value)
pass
override void make catalog(immutable list[string] path)
pass
static CURRENT : test store • new(resource utilCURRENT CATALOG, true) • top()
static ROOT : test store • new(resource utilROOT CATALOG, false) • top()
testcase test file catalogs()
assert CURRENTget id() • to string == "."
assert ROOTget id() • to string == "/"
testcase test simple resolve()
foo : "foo"
assert CURRENTresolve(foo) • to string == "foo"
assert ROOTresolve(foo) • to string == "/foo"
testcase test resolve extension()
bar : "bar"
assert CURRENTresolve(bar, html) • to string == "bar.html"
assert ROOTresolve(bar, html) • to string == "/bar.html"
testcase test sub catalogs()
dog : catresolve("dog")
assert dogto string == "dog"
cat2 : dogaccess catalog()
assert cat2get id() • to string == "dog"
dog2 : cat2resolve("Yoshka")
assert dog2to string == "dog/Yoshka"
testcase test root subdirs()
cat : ROOT
dog : catresolve("dog")
assert dogto string == "/dog"
cat2 : dogaccess catalog()
assert cat2get id() • to string == "/dog"
dog2 : cat2resolve("Yoshka")
assert dog2to string == "/dog/Yoshka"
testcase test multiple subdirs()
var foo : ROOT
var bar : fooresolve("bar")
assert barto string == "/bar"
foo = baraccess catalog()
assert fooget id() • to string == "/bar"
bar = fooresolve("baz")
assert barto string == "/bar/baz"
foo = baraccess catalog()
bar = fooresolve("quux")
assert barto string == "/bar/baz/quux"
foo = baraccess catalog()
bar = fooresolve("")
assert barto string == "/bar/baz/quux"
bar = fooresolve("./././.")
assert barto string == "/bar/baz/quux"
testcase test more subdir ops()
var foo : CURRENT
var bar : fooresolve("foo/bar/././baz")
assert "foo/bar/baz" == barto string
foo = baraccess catalog()
bar = fooresolve("..")
assert "foo/bar" == barto string
foo = baraccess catalog()
bar = fooresolve("../..")
assert "." == barto string
foo = baraccess catalog()
bar = fooresolve("..")
assert "." == barto string
testcase test parent catalog()
var bar : fooresolve("foo/bar/././baz")
assert "foo/bar/baz" == barto string
bar = barparent()
assert "foo/bar" == barto string
bar = barparent()
assert "foo" == barto string
bar = barparent()
assert "." == barto string
bar = barparent()
assert "." == barto string