aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
Diffstat (limited to 'spec')
-rw-r--r--spec/util_http_spec.lua23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/util_http_spec.lua b/spec/util_http_spec.lua
index bacfcfb5..0f51a86c 100644
--- a/spec/util_http_spec.lua
+++ b/spec/util_http_spec.lua
@@ -61,4 +61,27 @@ describe("util.http", function()
});
end);
end);
+
+ describe("normalize_path", function ()
+ it("root path is always '/'", function ()
+ assert.equal("/", http.normalize_path("/"));
+ assert.equal("/", http.normalize_path(""));
+ assert.equal("/", http.normalize_path("/", true));
+ assert.equal("/", http.normalize_path("", true));
+ end);
+
+ it("works", function ()
+ assert.equal("/foo", http.normalize_path("foo"));
+ assert.equal("/foo", http.normalize_path("/foo"));
+ assert.equal("/foo", http.normalize_path("foo/"));
+ assert.equal("/foo", http.normalize_path("/foo/"));
+ end);
+
+ it("is_dir works", function ()
+ assert.equal("/foo/", http.normalize_path("foo", true));
+ assert.equal("/foo/", http.normalize_path("/foo", true));
+ assert.equal("/foo/", http.normalize_path("foo/", true));
+ assert.equal("/foo/", http.normalize_path("/foo/", true));
+ end);
+ end);
end);