Created
February 19, 2017 02:15
-
-
Save guyzmo/35be5c581aaabf6f1c453cbc2a6e6147 to your computer and use it in GitHub Desktop.
first functional test case for neomutt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
+++++++++++++ | |
13 successes / 0 failures / 0 errors / 0 pending : 0.020419 seconds |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'busted.runner'() | |
local eq = function(exp, act) | |
return assert.are.same(exp, act) | |
end | |
local neq = function(exp, act) | |
return assert.are_not.same(exp, act) | |
end | |
local ok = function(res) | |
return assert.is_true(res) | |
end | |
local test_config_type = function(setting, a, b) | |
eq(a, mutt.get(setting)) | |
mutt.set(setting, b) | |
eq(b, mutt.get(setting)) | |
end | |
describe('lua API', function() | |
describe('test get/set', function() | |
it('works with DT_STR', function() | |
test_config_type("visual", "vim", "fubar") | |
end) | |
it('works with DT_NUM', function() | |
test_config_type("connect_timeout",69,42) | |
end) | |
it('works with DT_BOOL', function() | |
test_config_type("arrow_cursor", true, false) | |
end) | |
it('works with DT_QUAD', function() | |
test_config_type("abort_noattach", mutt.QUAD_NO, mutt.QUAD_ASKNO) | |
end) | |
it('works with DT_PATH', function() | |
test_config_type("alias_file", "tests/functional/test_runner.muttrc", "/dev/null") | |
end) | |
it('works with DT_MAGIC', function() | |
test_config_type("mbox_type", "mbox", "Maildir") | |
end) | |
it('works with DT_SORT', function() | |
test_config_type("sort", "from", "date") | |
end) | |
it('works with DT_RX', function() | |
test_config_type("mask", "!^\\\\.[^.]", ".*") | |
end) | |
it('works with DT_MBCHARTBL', function() | |
test_config_type("to_chars", "+TCFL", "+T") | |
end) | |
it('works with DT_ADR', function() | |
test_config_type("from", "[email protected]", "[email protected]") | |
end) | |
it('works with custom my_ variable DT_STR', function() | |
test_config_type("my_fubar", "Ford Prefect", "Zaphod Beeblebrox") | |
end) | |
it('detects a non-existent my_ variable DT_STR', function() | |
assert.has_error(function() mutt.get("my_doesnotexists") end) | |
end) | |
it('detects a non-existent other variable', function() | |
assert.has_error(function() mutt.get("doesnotexists") end) | |
end) | |
end) | |
end) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set visual=vim | |
set connect_timeout=69 | |
set arrow_cursor | |
set mask="!^\\.[^.]" | |
set to_chars="+TCFL" | |
set sort="from" | |
set from="[email protected]" | |
set my_fubar="Ford Prefect" | |
lua-source tests/functional/test_lua-api_spec.lua |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment