aboutsummaryrefslogtreecommitdiffstats
path: root/spec
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-10-14 14:32:02 +0200
committerKim Alvefur <zash@zash.se>2018-10-14 14:32:02 +0200
commit86247abe7864894ba30caf07beee1b53df5ab07c (patch)
treec69cf99e8025c42af5ac630469e4a657a26ad152 /spec
parent41abd787baed57bd35beb1745067b0be4b3fa185 (diff)
downloadprosody-86247abe7864894ba30caf07beee1b53df5ab07c.tar.gz
prosody-86247abe7864894ba30caf07beee1b53df5ab07c.zip
util.http: Add tests for normalize_path
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);