Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJason Perkins <starkos@industriousone.com>2014-09-16 19:40:47 +0400
committerJason Perkins <starkos@industriousone.com>2014-09-16 19:40:47 +0400
commit793140632759c79b0183619306fb60ec17133243 (patch)
tree8107af7fd3d7a0964f750ca0f8db8d9275efaed3 /tests
parent849510cf35ea35d1463382997d9381bf4a728146 (diff)
Backport native path functions from Premake-dev
Diffstat (limited to 'tests')
-rw-r--r--tests/base/test_path.lua56
1 files changed, 28 insertions, 28 deletions
diff --git a/tests/base/test_path.lua b/tests/base/test_path.lua
index 2332dce..46e3181 100644
--- a/tests/base/test_path.lua
+++ b/tests/base/test_path.lua
@@ -24,26 +24,26 @@
function suite.getabsolute_RemovesDotDots_OnPosixAbsolute()
test.isequal("/ProjectB/bin", path.getabsolute("/ProjectA/../ProjectB/bin"))
end
-
+
function suite.getabsolute_OnTrailingSlash()
local expected = path.translate(os.getcwd(), "/") .. "/a/b/c"
test.isequal(expected, path.getabsolute("a/b/c/"))
end
-
+
function suite.getabsolute_OnLeadingEnvVar()
test.isequal("$(HOME)/user", path.getabsolute("$(HOME)/user"))
end
-
- function suite.getabsolute_OnMultipleEnvVar()
+
+ function suite.getabsolute_OnMultipleEnvVar()
test.isequal("$(HOME)/$(USER)", path.getabsolute("$(HOME)/$(USER)"))
end
-
+
function suite.getabsolute_OnTrailingEnvVar()
local expected = path.translate(os.getcwd(), "/") .. "/home/$(USER)"
test.isequal(expected, path.getabsolute("home/$(USER)"))
end
-
-
+
+
--
-- path.getbasename() tests
--
@@ -60,11 +60,11 @@
function suite.getdirectory_ReturnsEmptyString_OnNoDirectory()
test.isequal(".", path.getdirectory("filename.ext"))
end
-
+
function suite.getdirectory_ReturnsDirectory_OnSingleLevelPath()
test.isequal("dir0", path.getdirectory("dir0/filename.ext"))
end
-
+
function suite.getdirectory_ReturnsDirectory_OnMultiLeveLPath()
test.isequal("dir0/dir1/dir2", path.getdirectory("dir0/dir1/dir2/filename.ext"))
end
@@ -72,7 +72,7 @@
function suite.getdirectory_ReturnsRootPath_OnRootPathOnly()
test.isequal("/", path.getdirectory("/filename.ext"))
end
-
+
--
@@ -82,13 +82,13 @@
function suite.getdrive_ReturnsNil_OnNotWindows()
test.isnil(path.getdrive("/hello"))
end
-
+
function suite.getdrive_ReturnsLetter_OnWindowsAbsolute()
test.isequal("x", path.getdrive("x:/hello"))
end
-
-
-
+
+
+
--
-- path.getextension() tests
--
@@ -100,19 +100,19 @@
function suite.getextension_ReturnsExtension()
test.isequal(".txt", path.getextension("filename.txt"))
end
-
+
function suite.getextension_OnMultipleDots()
test.isequal(".txt", path.getextension("filename.mod.txt"))
end
-
+
function suite.getextension_OnLeadingNumeric()
test.isequal(".7z", path.getextension("filename.7z"))
end
-
+
function suite.getextension_OnUnderscore()
test.isequal(".a_c", path.getextension("filename.a_c"))
end
-
+
function suite.getextension_OnHyphen()
test.isequal(".a-c", path.getextension("filename.a-c"))
end
@@ -130,7 +130,7 @@
function suite.getrelative_ReturnsDoubleDot_OnChildToParent()
test.isequal("..", path.getrelative("/a/b/c", "/a/b"))
end
-
+
function suite.getrelative_ReturnsDoubleDot_OnSiblingToSibling()
test.isequal("../d", path.getrelative("/a/b/c", "/a/b/d"))
end
@@ -142,19 +142,19 @@
function suite.getrelative_ReturnsChildPath_OnWindowsAbsolute()
test.isequal("obj/debug", path.getrelative("C:/Code/Premake4", "C:/Code/Premake4/obj/debug"))
end
-
+
function suite.getrelative_ReturnsAbsPath_OnDifferentDriveLetters()
test.isequal("D:/Files", path.getrelative("C:/Code/Premake4", "D:/Files"))
end
-
+
function suite.getrelative_ReturnsAbsPath_OnDollarMacro()
test.isequal("$(SDK_HOME)/include", path.getrelative("C:/Code/Premake4", "$(SDK_HOME)/include"))
end
-
+
function suite.getrelative_ReturnsAbsPath_OnRootedPath()
test.isequal("/opt/include", path.getrelative("/home/me/src/project", "/opt/include"))
end
-
+
--
-- path.isabsolute() tests
@@ -171,7 +171,7 @@
function suite.isabsolute_ReturnsFalse_OnRelativePath()
test.isfalse(path.isabsolute("a/b/c"))
end
-
+
function suite.isabsolute_ReturnsTrue_OnDollarSign()
test.istrue(path.isabsolute("$(SDK_HOME)/include"))
end
@@ -184,11 +184,11 @@
function suite.join_OnValidParts()
test.isequal("p1/p2", path.join("p1", "p2"))
end
-
+
function suite.join_OnAbsoluteUnixPath()
test.isequal("/p2", path.join("p1", "/p2"))
end
-
+
function suite.join_OnAbsoluteWindowsPath()
test.isequal("C:/p2", path.join("p1", "C:/p2"))
end
@@ -196,11 +196,11 @@
function suite.join_OnCurrentDirectory()
test.isequal("p2", path.join(".", "p2"))
end
-
+
function suite.join_OnNilSecondPart()
test.isequal("p1", path.join("p1", nil))
end
-
+
function suite.join_onMoreThanTwoParts()
test.isequal("p1/p2/p3", path.join("p1", "p2", "p3"))
end