aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2017-12-23 11:53:26 +0100
committerAlbert Krewinkel <albert@zeitkraut.de>2017-12-23 13:42:35 +0100
commit35f0567a8fe840ca65f8474d0293942c76a1220f (patch)
tree7664aec1683cdec1fbf7696e449a8512978fd21a /test
parentef4351c4d2dee9b392c80e439a3c0f0d60594a33 (diff)
downloadpandoc-35f0567a8fe840ca65f8474d0293942c76a1220f.tar.gz
Lua modules: add function pandoc.utils.to_roman_numeral
The function allows conversion of numbers below 4000 into roman numerals.
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Lua.hs1
-rw-r--r--test/lua/test-pandoc-utils.lua9
2 files changed, 10 insertions, 0 deletions
diff --git a/test/Tests/Lua.hs b/test/Tests/Lua.hs
index 57e7c5f0c..956575911 100644
--- a/test/Tests/Lua.hs
+++ b/test/Tests/Lua.hs
@@ -102,6 +102,7 @@ tests = map (localOption (QuickCheckTests 20))
, plain (str "read: OK")
, plain (str "failing read: OK")
, plain (str "stringify: OK")
+ , plain (str "to_roman_numeral: OK")
])
]
diff --git a/test/lua/test-pandoc-utils.lua b/test/lua/test-pandoc-utils.lua
index ce3456d5d..0a7aedbfd 100644
--- a/test/lua/test-pandoc-utils.lua
+++ b/test/lua/test-pandoc-utils.lua
@@ -64,6 +64,14 @@ function test_stringify ()
return utils.stringify(inline) == 'Cogito ergo sum.'
end
+-- to_roman_numeral
+------------------------------------------------------------------------
+function test_to_roman_numeral ()
+ return utils.to_roman_numeral(1888) == 'MDCCCLXXXVIII'
+ -- calling with a string fails
+ and not pcall(utils.to_roman_numeral, 'not a number')
+end
+
-- Return result
------------------------------------------------------------------------
function run(fn)
@@ -78,5 +86,6 @@ function Para (el)
pandoc.Plain{pandoc.Str("read: " .. run(test_read))},
pandoc.Plain{pandoc.Str("failing read: " .. run(test_failing_read))},
pandoc.Plain{pandoc.Str("stringify: " .. run(test_stringify))},
+ pandoc.Plain{pandoc.Str("to_roman_numeral: " .. run(test_to_roman_numeral))},
}
end