test suite test resolver
implicit import idealmachineresources
class test store
public test store(string path prefix, boolean is current)
super(path prefix, is current, is current)
override boolean exists(string scheme, immutable list[string] path)
return false
override string read string(string scheme, immutable list[string] path)
return "test"
override void write string(string scheme, immutable list[string] path, string new value)
pass
override void make catalog(string scheme, immutable list[string] path)
pass
override readonly set[string] or null read catalog(string scheme, immutable list[string] path) pure
return missinginstance
implement protected string default scheme() => resource utilFILE SCHEME
static CURRENT : test store • new(resource utilCURRENT CATALOG, true) • top()
static ROOT : test store • new(resource utilROOT CATALOG, false) • top()
test case test file catalogs()
assert CURRENTget id() • to string == "."
assert ROOTget id() • to string == "/"
test case test simple resolve()
foo : "foo"
assert CURRENTresolve(foo) • to string == "foo"
assert ROOTresolve(foo) • to string == "/foo"
test case test resolve extension()
bar : "bar"
assert CURRENTresolve(bar, html) • to string == "bar.html"
assert ROOTresolve(bar, html) • to string == "/bar.html"
test case 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"
test case 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"
test case 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"
test case 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
test case 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
test case test filesystem()
directory name : "runtime/resources"
file set : hash set[string] • new()
file setadd all(["base_extension.i", "base_resource_catalog.i", "base_resource_identifier.i", "base_resource_store.i", "make_catalog_option.i", "resource_store.i", "resource_util.i", "resources.i", "test_resolver.i"])
directory : filesystemCURRENT CATALOGresolve(directory name) • access catalog()
content : directorycontent
assert content is_not null
for (file : contentelements)
name : filekey
assert filevalueto string == (directory name ++ "/" ++ name)
assert file setcontains(name)
file setremove(name)
return file setis empty