1utils = require 'pandoc'
4------------------------------------------------------------------------
6 local ref_hash = '0a0a9f2a6772942557ab5355d76af442f8f65e01'
7 local hash = utils.sha1 'Hello, World!'
8 return hash == ref_hash
12------------------------------------------------------------------------
13function file_exists (filename)
14 local fh = io.open(filename, 'r')
15 return fh ~= nil and (fh:close() or true)
18function warn (...) io.stderr:write(...) end
21 if not file_exists('/bin/sed') then
22 warn 'Did not find /bin/sed, skipping test'
25 local pipe_result = utils.pipe('/bin/sed', {'-e', 's/a/b/'}, 'abc')
26 return pipe_result == 'bbc'
29function test_failing_pipe ()
30 if not file_exists('/bin/false') then
31 warn 'Did not find /bin/false, skipping test'
34 local res, err = pcall(utils.pipe, '/bin/false', {}, 'abc')
36 err.command == '/bin/false' and
37 err.error_code == 1 and
42------------------------------------------------------------------------
44 local valid_markdown = '*Hello*, World!\n'
45 local res = pandoc.read(valid_markdown).blocks[1].content
46 return res[1].t == 'Emph' and res[3].t == 'Space' and res[4].t == 'Str'
49function test_failing_read ()
50 local res, err = pcall(pandoc.read, 'foo', 'nosuchreader')
51 return not res and err:match 'Unknown reader: nosuchreader'
56------------------------------------------------------------------------
58 return fn() and "OK" or "FAIL"
63 pandoc.Plain{pandoc.Str("sha1: " .. run(test_sha1))},
64 pandoc.Plain{pandoc.Str("pipe: " .. run(test_pipe))},
65 pandoc.Plain{pandoc.Str("failing pipe: " .. run(test_failing_pipe))},
66 pandoc.Plain{pandoc.Str("read: " .. run(test_read))},
67 pandoc.Plain{pandoc.Str("failing read: " .. run(test_failing_read))},
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list