diff options
author | starkos <none@none> | 2008-10-31 21:38:05 +0300 |
---|---|---|
committer | starkos <none@none> | 2008-10-31 21:38:05 +0300 |
commit | c257e9c746f096ca4294168a8a2c26de538eb36c (patch) | |
tree | 8cf84989823ea063e60f805b8dedb619730bd5bc /tests/test_string.lua | |
parent | b2f4cfdc24ae7a45049ada7dd2afd91cb52053d1 (diff) |
First integration of new Lua-based architecture
Diffstat (limited to 'tests/test_string.lua')
-rw-r--r-- | tests/test_string.lua | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/test_string.lua b/tests/test_string.lua new file mode 100644 index 0000000..3ce1f1f --- /dev/null +++ b/tests/test_string.lua @@ -0,0 +1,43 @@ +-- +-- tests/test_string.lua +-- Automated test suite for the new string functions. +-- Copyright (c) 2008 Jason Perkins and the Premake project +-- + + + T.string = { } + + +-- +-- string.endswith() tests +-- + + function T.string.endswith_ReturnsTrue_OnMatch() + test.istrue(string.endswith("Abcdef", "def")) + end + + function T.string.endswith_ReturnsFalse_OnMismatch() + test.isfalse(string.endswith("Abcedf", "efg")) + end + + function T.string.endswith_ReturnsFalse_OnLongerNeedle() + test.isfalse(string.endswith("Abc", "Abcdef")) + end + + function T.string.endswith_ReturnsFalse_OnNilHaystack() + test.isfalse(string.endswith(nil, "ghi")) + end + + function T.string.endswith_ReturnsFalse_OnNilNeedle() + test.isfalse(string.endswith("Abc", nil)) + end + + + +-- +-- string.explode() tests +-- + + function T.string.explode_ReturnsParts_OnValidCall() + test.isequal({"aaa","bbb","ccc"}, string.explode("aaa/bbb/ccc", "/", true)) + end |