diff options
| author | Hisham Muhammad <hisham@gobolinux.org> | 2021-03-16 13:36:26 -0300 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2021-03-16 16:32:45 -0300 |
| commit | 8f3ce333e7a1abfc6bf0488817d9eff4a2fd443f (patch) | |
| tree | f05d1a49995341a56e602ce2a3256b89372e9d04 /spec/test_spec.lua | |
| parent | 2b56388e76952be52d849415b1ebae74b6dc4607 (diff) | |
| download | luarocks-8f3ce333e7a1abfc6bf0488817d9eff4a2fd443f.tar.gz luarocks-8f3ce333e7a1abfc6bf0488817d9eff4a2fd443f.tar.bz2 luarocks-8f3ce333e7a1abfc6bf0488817d9eff4a2fd443f.zip | |
editorconfig: trim trailing whitespace
Diffstat (limited to 'spec/test_spec.lua')
| -rw-r--r-- | spec/test_spec.lua | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/spec/test_spec.lua b/spec/test_spec.lua index ddb64b0e..220ae632 100644 --- a/spec/test_spec.lua +++ b/spec/test_spec.lua | |||
| @@ -17,7 +17,7 @@ local extra_rocks = { | |||
| 17 | "/luassert-1.8.0-0.rockspec", | 17 | "/luassert-1.8.0-0.rockspec", |
| 18 | "/lua-term-0.7-1.rockspec", | 18 | "/lua-term-0.7-1.rockspec", |
| 19 | "/penlight-1.5.4-1.rockspec", | 19 | "/penlight-1.5.4-1.rockspec", |
| 20 | "/mediator_lua-1.1.2-0.rockspec", | 20 | "/mediator_lua-1.1.2-0.rockspec", |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | describe("luarocks test #integration", function() | 23 | describe("luarocks test #integration", function() |
| @@ -59,7 +59,7 @@ describe("luarocks test #integration", function() | |||
| 59 | test_env.remove_dir("busted_project-0.1-1") | 59 | test_env.remove_dir("busted_project-0.1-1") |
| 60 | os.remove("busted_project-0.1-1.src.rock") | 60 | os.remove("busted_project-0.1-1.src.rock") |
| 61 | end) | 61 | end) |
| 62 | 62 | ||
| 63 | -- make luassert | 63 | -- make luassert |
| 64 | assert.is_true(run.luarocks_bool("download --server="..testing_paths.fixtures_repo_dir.." busted_project 0.1-1")) | 64 | assert.is_true(run.luarocks_bool("download --server="..testing_paths.fixtures_repo_dir.." busted_project 0.1-1")) |
| 65 | assert.is_true(run.luarocks_bool("unpack busted_project-0.1-1.src.rock")) | 65 | assert.is_true(run.luarocks_bool("unpack busted_project-0.1-1.src.rock")) |
| @@ -84,7 +84,7 @@ local test_command = require("luarocks.test.command") | |||
| 84 | 84 | ||
| 85 | describe("LuaRocks test #unit", function() | 85 | describe("LuaRocks test #unit", function() |
| 86 | local runner | 86 | local runner |
| 87 | 87 | ||
| 88 | lazy_setup(function() | 88 | lazy_setup(function() |
| 89 | cfg.init() | 89 | cfg.init() |
| 90 | fs.init() | 90 | fs.init() |
| @@ -92,14 +92,14 @@ describe("LuaRocks test #unit", function() | |||
| 92 | runner.init(testing_paths.testrun_dir .. "/luacov.config") | 92 | runner.init(testing_paths.testrun_dir .. "/luacov.config") |
| 93 | runner.tick = true | 93 | runner.tick = true |
| 94 | end) | 94 | end) |
| 95 | 95 | ||
| 96 | lazy_teardown(function() | 96 | lazy_teardown(function() |
| 97 | runner.shutdown() | 97 | runner.shutdown() |
| 98 | end) | 98 | end) |
| 99 | 99 | ||
| 100 | local tmpdir | 100 | local tmpdir |
| 101 | local olddir | 101 | local olddir |
| 102 | 102 | ||
| 103 | local create_tmp_dir = function() | 103 | local create_tmp_dir = function() |
| 104 | tmpdir = get_tmp_path() | 104 | tmpdir = get_tmp_path() |
| 105 | olddir = lfs.currentdir() | 105 | olddir = lfs.currentdir() |
| @@ -107,7 +107,7 @@ describe("LuaRocks test #unit", function() | |||
| 107 | lfs.chdir(tmpdir) | 107 | lfs.chdir(tmpdir) |
| 108 | fs.change_dir(tmpdir) | 108 | fs.change_dir(tmpdir) |
| 109 | end | 109 | end |
| 110 | 110 | ||
| 111 | local destroy_tmp_dir = function() | 111 | local destroy_tmp_dir = function() |
| 112 | if olddir then | 112 | if olddir then |
| 113 | lfs.chdir(olddir) | 113 | lfs.chdir(olddir) |
| @@ -116,47 +116,47 @@ describe("LuaRocks test #unit", function() | |||
| 116 | end | 116 | end |
| 117 | end | 117 | end |
| 118 | end | 118 | end |
| 119 | 119 | ||
| 120 | describe("test.command", function() | 120 | describe("test.command", function() |
| 121 | describe("command.detect_type", function() | 121 | describe("command.detect_type", function() |
| 122 | before_each(function() | 122 | before_each(function() |
| 123 | create_tmp_dir() | 123 | create_tmp_dir() |
| 124 | end) | 124 | end) |
| 125 | 125 | ||
| 126 | after_each(function() | 126 | after_each(function() |
| 127 | destroy_tmp_dir() | 127 | destroy_tmp_dir() |
| 128 | end) | 128 | end) |
| 129 | 129 | ||
| 130 | it("returns true if test.lua exists", function() | 130 | it("returns true if test.lua exists", function() |
| 131 | write_file("test.lua", "", finally) | 131 | write_file("test.lua", "", finally) |
| 132 | assert.truthy(test_command.detect_type()) | 132 | assert.truthy(test_command.detect_type()) |
| 133 | end) | 133 | end) |
| 134 | 134 | ||
| 135 | it("returns false if test.lua doesn't exist", function() | 135 | it("returns false if test.lua doesn't exist", function() |
| 136 | assert.falsy(test_command.detect_type()) | 136 | assert.falsy(test_command.detect_type()) |
| 137 | end) | 137 | end) |
| 138 | end) | 138 | end) |
| 139 | 139 | ||
| 140 | describe("command.run_tests", function() | 140 | describe("command.run_tests", function() |
| 141 | before_each(function() | 141 | before_each(function() |
| 142 | create_tmp_dir() | 142 | create_tmp_dir() |
| 143 | end) | 143 | end) |
| 144 | 144 | ||
| 145 | after_each(function() | 145 | after_each(function() |
| 146 | destroy_tmp_dir() | 146 | destroy_tmp_dir() |
| 147 | end) | 147 | end) |
| 148 | 148 | ||
| 149 | it("returns the result of the executed tests", function() | 149 | it("returns the result of the executed tests", function() |
| 150 | write_file("test.lua", "assert(1==1)", finally) | 150 | write_file("test.lua", "assert(1==1)", finally) |
| 151 | assert.truthy(test_command.run_tests(nil, {})) | 151 | assert.truthy(test_command.run_tests(nil, {})) |
| 152 | 152 | ||
| 153 | write_file("test.lua", "assert(1==2)", finally) | 153 | write_file("test.lua", "assert(1==2)", finally) |
| 154 | assert.falsy(test_command.run_tests(nil, {})) | 154 | assert.falsy(test_command.run_tests(nil, {})) |
| 155 | end) | 155 | end) |
| 156 | 156 | ||
| 157 | it("returns the result of the executed tests with custom arguments and test command", function() | 157 | it("returns the result of the executed tests with custom arguments and test command", function() |
| 158 | write_file("test.lua", "assert(1==1)", finally) | 158 | write_file("test.lua", "assert(1==1)", finally) |
| 159 | 159 | ||
| 160 | local test = { | 160 | local test = { |
| 161 | script = "test.lua", | 161 | script = "test.lua", |
| 162 | flags = { | 162 | flags = { |
| @@ -167,76 +167,76 @@ describe("LuaRocks test #unit", function() | |||
| 167 | } | 167 | } |
| 168 | assert.truthy(test_command.run_tests(test, {})) | 168 | assert.truthy(test_command.run_tests(test, {})) |
| 169 | end) | 169 | end) |
| 170 | 170 | ||
| 171 | it("returns false and does nothing if the test script doesn't exist", function() | 171 | it("returns false and does nothing if the test script doesn't exist", function() |
| 172 | assert.falsy(test_command.run_tests(nil, {})) | 172 | assert.falsy(test_command.run_tests(nil, {})) |
| 173 | end) | 173 | end) |
| 174 | end) | 174 | end) |
| 175 | end) | 175 | end) |
| 176 | 176 | ||
| 177 | describe("test.busted", function() | 177 | describe("test.busted", function() |
| 178 | describe("busted.detect_type", function() | 178 | describe("busted.detect_type", function() |
| 179 | before_each(function() | 179 | before_each(function() |
| 180 | create_tmp_dir() | 180 | create_tmp_dir() |
| 181 | end) | 181 | end) |
| 182 | 182 | ||
| 183 | after_each(function() | 183 | after_each(function() |
| 184 | destroy_tmp_dir() | 184 | destroy_tmp_dir() |
| 185 | end) | 185 | end) |
| 186 | 186 | ||
| 187 | it("returns true if .busted exists", function() | 187 | it("returns true if .busted exists", function() |
| 188 | write_file(".busted", "", finally) | 188 | write_file(".busted", "", finally) |
| 189 | assert.truthy(test_busted.detect_type()) | 189 | assert.truthy(test_busted.detect_type()) |
| 190 | end) | 190 | end) |
| 191 | 191 | ||
| 192 | it("returns false if .busted doesn't exist", function() | 192 | it("returns false if .busted doesn't exist", function() |
| 193 | assert.falsy(test_busted.detect_type()) | 193 | assert.falsy(test_busted.detect_type()) |
| 194 | end) | 194 | end) |
| 195 | end) | 195 | end) |
| 196 | 196 | ||
| 197 | describe("busted.run_tests", function() | 197 | describe("busted.run_tests", function() |
| 198 | before_each(function() | 198 | before_each(function() |
| 199 | path.use_tree(testing_paths.testing_sys_tree) | 199 | path.use_tree(testing_paths.testing_sys_tree) |
| 200 | create_tmp_dir() | 200 | create_tmp_dir() |
| 201 | end) | 201 | end) |
| 202 | 202 | ||
| 203 | after_each(function() | 203 | after_each(function() |
| 204 | destroy_tmp_dir() | 204 | destroy_tmp_dir() |
| 205 | end) | 205 | end) |
| 206 | 206 | ||
| 207 | pending("returns the result of the executed tests", function() | 207 | pending("returns the result of the executed tests", function() |
| 208 | -- FIXME: busted issue | 208 | -- FIXME: busted issue |
| 209 | write_file("test_spec.lua", "assert(1==1)", finally) | 209 | write_file("test_spec.lua", "assert(1==1)", finally) |
| 210 | assert.truthy(test_busted.run_tests(nil, {})) | 210 | assert.truthy(test_busted.run_tests(nil, {})) |
| 211 | 211 | ||
| 212 | write_file("test_spec.lua", "assert(1==2)", finally) | 212 | write_file("test_spec.lua", "assert(1==2)", finally) |
| 213 | assert.falsy(test_busted.run_tests()) | 213 | assert.falsy(test_busted.run_tests()) |
| 214 | end) | 214 | end) |
| 215 | end) | 215 | end) |
| 216 | end) | 216 | end) |
| 217 | 217 | ||
| 218 | describe("test", function() | 218 | describe("test", function() |
| 219 | describe("test.run_test_suite", function() | 219 | describe("test.run_test_suite", function() |
| 220 | before_each(function() | 220 | before_each(function() |
| 221 | create_tmp_dir() | 221 | create_tmp_dir() |
| 222 | end) | 222 | end) |
| 223 | 223 | ||
| 224 | after_each(function() | 224 | after_each(function() |
| 225 | destroy_tmp_dir() | 225 | destroy_tmp_dir() |
| 226 | end) | 226 | end) |
| 227 | 227 | ||
| 228 | it("returns false if the given rockspec cannot be loaded", function() | 228 | it("returns false if the given rockspec cannot be loaded", function() |
| 229 | assert.falsy(test.run_test_suite("invalid", nil, {})) | 229 | assert.falsy(test.run_test_suite("invalid", nil, {})) |
| 230 | end) | 230 | end) |
| 231 | 231 | ||
| 232 | it("returns false if no test type was detected", function() | 232 | it("returns false if no test type was detected", function() |
| 233 | assert.falsy(test.run_test_suite({ package = "test" }, nil, {})) | 233 | assert.falsy(test.run_test_suite({ package = "test" }, nil, {})) |
| 234 | end) | 234 | end) |
| 235 | 235 | ||
| 236 | it("returns the result of executing the tests specified in the given rockspec", function() | 236 | it("returns the result of executing the tests specified in the given rockspec", function() |
| 237 | write_file("test.lua", "assert(1==1)", finally) | 237 | write_file("test.lua", "assert(1==1)", finally) |
| 238 | assert.truthy(test.run_test_suite({ test_dependencies = {} }, nil, {})) | 238 | assert.truthy(test.run_test_suite({ test_dependencies = {} }, nil, {})) |
| 239 | 239 | ||
| 240 | write_file("test.lua", "assert(1==2)", finally) | 240 | write_file("test.lua", "assert(1==2)", finally) |
| 241 | assert.falsy(test.run_test_suite({ test_dependencies = {} }, nil, {})) | 241 | assert.falsy(test.run_test_suite({ test_dependencies = {} }, nil, {})) |
| 242 | end) | 242 | end) |
