summaryrefslogtreecommitdiff
path: root/tests/test_utils
diff options
context:
space:
mode:
authorOpportunityLiu <[email protected]>2019-06-18 19:50:39 +0800
committerOpportunityLiu <[email protected]>2019-06-18 19:50:39 +0800
commit98d4504577b586ef2398346a0db2743081cf03a8 (patch)
tree3aab00679f61eee14a62afb3989ed3d278bdb5a3 /tests/test_utils
parent0c58eac269fda12b1568bc9704237a48aedbc4b3 (diff)
skip some tests
Diffstat (limited to 'tests/test_utils')
-rw-r--r--tests/test_utils/context.lua13
-rw-r--r--tests/test_utils/test_assert.lua9
-rw-r--r--tests/test_utils/test_build.lua (renamed from tests/test_utils/build.lua)9
-rw-r--r--tests/test_utils/test_skip.lua13
4 files changed, 37 insertions, 7 deletions
diff --git a/tests/test_utils/context.lua b/tests/test_utils/context.lua
new file mode 100644
index 000000000..50271ac76
--- /dev/null
+++ b/tests/test_utils/context.lua
@@ -0,0 +1,13 @@
+import("test_build")
+import("test_skip")
+import("test_assert")
+
+function main(filename)
+
+ local context = { filename = filename }
+ table.join2(context, test_build())
+ table.join2(context, test_skip())
+ table.join2(context, test_assert())
+
+ return context
+end \ No newline at end of file
diff --git a/tests/test_utils/test_assert.lua b/tests/test_utils/test_assert.lua
index 4a97cb3ac..a964fcfb3 100644
--- a/tests/test_utils/test_assert.lua
+++ b/tests/test_utils/test_assert.lua
@@ -1,8 +1,8 @@
-import("print_error")
+
import("check")
-local test_assert = { print_error = print_error.main }
+local test_assert = { print_error = import("print_error", { anonymous = true }).main }
function test_assert:require(value)
if not value then
@@ -66,7 +66,6 @@ function test_assert:will_raise(func, message_pattern)
table.remove(self._will_raise_stack, 1)
end
-function main(context)
- table.join2(context, test_assert)
- return context
+function main()
+ return test_assert
end
diff --git a/tests/test_utils/build.lua b/tests/test_utils/test_build.lua
index 7725f1ddc..4625a5943 100644
--- a/tests/test_utils/build.lua
+++ b/tests/test_utils/test_build.lua
@@ -1,8 +1,9 @@
-- imports
import("privilege.sudo")
--- main entry
-function main(argv)
+local test_build = {}
+
+function test_build:build(argv)
-- check global config
os.exec("xmake g -c")
@@ -35,3 +36,7 @@ function main(argv)
end
end
end
+
+function main()
+ return test_build
+end
diff --git a/tests/test_utils/test_skip.lua b/tests/test_utils/test_skip.lua
new file mode 100644
index 000000000..c17f2c42c
--- /dev/null
+++ b/tests/test_utils/test_skip.lua
@@ -0,0 +1,13 @@
+local test_skip = { _is_skipped_tag = {true} }
+
+function test_skip:skip(reason)
+ return { is_skipped = self._is_skipped_tag, reason = reason, context = self }
+end
+
+function test_skip:is_skipped(result)
+ return result and result.context and result.context._is_skipped_tag == result.is_skipped
+end
+
+function main()
+ return test_skip
+end \ No newline at end of file