diff options
| author | robooo <robo.karasek@gmail.com> | 2016-07-07 21:58:19 +0200 |
|---|---|---|
| committer | Hisham Muhammad <hisham@gobolinux.org> | 2016-07-07 16:58:19 -0300 |
| commit | 5af7e0d7c2dcf65e41ae8523f3771e9528be32a7 (patch) | |
| tree | bcd14624e0566a23da2e708675197d212cecf35d /spec/doc_spec.lua | |
| parent | b5b285a678fe78b80d452cc9eb7565b8bf087b81 (diff) | |
| download | luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.tar.gz luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.tar.bz2 luarocks-5af7e0d7c2dcf65e41ae8523f3771e9528be32a7.zip | |
New test-suite for LuaRocks (#581)
First version of new test-suite, using Busted framework based on Google Summer of Code project:
https://summerofcode.withgoogle.com/projects/#5695811874717696
* Rewritten from Bash to Lua
* Tests now check if they did what they were supposed to, beyond only checking success or failure of the `luarocks` command
* Support for black-box (launching `luarocks` as an external command) and white-box (testing functions in modules directly) testing
Diffstat (limited to 'spec/doc_spec.lua')
| -rw-r--r-- | spec/doc_spec.lua | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/spec/doc_spec.lua b/spec/doc_spec.lua new file mode 100644 index 00000000..476b8ea8 --- /dev/null +++ b/spec/doc_spec.lua | |||
| @@ -0,0 +1,57 @@ | |||
| 1 | local test_env = require("test/test_environment") | ||
| 2 | local lfs = require("lfs") | ||
| 3 | |||
| 4 | test_env.unload_luarocks() | ||
| 5 | local doc = require("luarocks.doc") | ||
| 6 | |||
| 7 | local extra_rocks = { | ||
| 8 | "/luarepl-0.4-1.src.rock" | ||
| 9 | } | ||
| 10 | |||
| 11 | expose("LuaRocks doc tests #blackbox #b_doc", function() | ||
| 12 | |||
| 13 | before_each(function() | ||
| 14 | test_env.setup_specs(extra_rocks) | ||
| 15 | testing_paths = test_env.testing_paths | ||
| 16 | run = test_env.run | ||
| 17 | end) | ||
| 18 | |||
| 19 | describe("LuaRocks doc basic tests", function() | ||
| 20 | it("LuaRocks doc with no flags/arguments", function() | ||
| 21 | assert.is_false(run.luarocks_bool("doc")) | ||
| 22 | end) | ||
| 23 | it("LuaRocks doc with invalid argument", function() | ||
| 24 | assert.is_false(run.luarocks_bool("doc invalid")) | ||
| 25 | end) | ||
| 26 | end) | ||
| 27 | |||
| 28 | describe("LuaRocks doc tests with flags", function() | ||
| 29 | it("LuaRocks doc of installed luarepl", function() | ||
| 30 | assert.is_true(run.luarocks_bool("install luarepl")) | ||
| 31 | assert.is_true(run.luarocks_bool("doc luarepl")) | ||
| 32 | end) | ||
| 33 | |||
| 34 | it("LuaRocks doc of luacov and access its home page", function() | ||
| 35 | assert.is_true(run.luarocks_bool("install luacov")) | ||
| 36 | assert.is_true(run.luarocks_bool("doc luacov --home")) | ||
| 37 | end) | ||
| 38 | |||
| 39 | it("LuaRocks doc of luacov and list doc folder", function() | ||
| 40 | assert.is_true(run.luarocks_bool("install luacov")) | ||
| 41 | local output = assert.is.truthy(run.luarocks("doc luacov --list")) | ||
| 42 | assert.is.truthy(output:find("/lib/luarocks/rocks/luacov/0.11.0--1/doc/")) | ||
| 43 | end) | ||
| 44 | |||
| 45 | it("LuaRocks doc of luacov local", function() | ||
| 46 | assert.is_true(run.luarocks_bool("install luacov")) | ||
| 47 | assert.is_true(run.luarocks_bool("doc luacov --local")) | ||
| 48 | end) | ||
| 49 | |||
| 50 | it("LuaRocks doc of luacov porcelain", function() | ||
| 51 | assert.is_true(run.luarocks_bool("install luacov")) | ||
| 52 | assert.is_true(run.luarocks_bool("doc luacov --porcelain")) | ||
| 53 | end) | ||
| 54 | end) | ||
| 55 | end) | ||
| 56 | |||
| 57 | |||
