diff options
author | Kim Alvefur <zash@zash.se> | 2018-10-14 14:32:02 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-10-14 14:32:02 +0200 |
commit | cb124b41ceb043e29f6866c213c1a5af0b0e3b9e (patch) | |
tree | c69cf99e8025c42af5ac630469e4a657a26ad152 | |
parent | 0abe1f81419a1df23df88ef7063b3cb0713bbfdc (diff) | |
download | prosody-cb124b41ceb043e29f6866c213c1a5af0b0e3b9e.tar.gz prosody-cb124b41ceb043e29f6866c213c1a5af0b0e3b9e.zip |
util.http: Add tests for normalize_path
-rw-r--r-- | spec/util_http_spec.lua | 23 |
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); |