aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/nvim/testdir/test_escaped_glob.vim17
-rw-r--r--src/nvim/testdir/test_timers.vim35
-rw-r--r--test/functional/api/menu_spec.lua8
-rw-r--r--test/functional/eval/execute_spec.lua4
-rw-r--r--test/functional/eval/input_spec.lua16
-rw-r--r--test/functional/eval/timer_spec.lua15
-rw-r--r--test/functional/legacy/008_autocommands_spec.lua45
-rw-r--r--test/functional/legacy/search_spec.lua21
-rw-r--r--test/functional/normal/put_spec.lua13
-rw-r--r--test/functional/options/fillchars_spec.lua7
-rw-r--r--test/functional/terminal/scrollback_spec.lua3
-rw-r--r--test/functional/terminal/tui_spec.lua4
-rw-r--r--test/functional/ui/cmdline_highlight_spec.lua18
-rw-r--r--test/functional/ui/cmdline_spec.lua11
-rw-r--r--test/functional/ui/highlight_spec.lua4
-rw-r--r--test/functional/ui/inccommand_spec.lua48
-rw-r--r--test/functional/ui/mouse_spec.lua27
-rw-r--r--test/functional/ui/output_spec.lua19
-rw-r--r--test/functional/ui/screen.lua161
-rw-r--r--test/functional/ui/screen_basic_spec.lua35
-rw-r--r--test/functional/ui/searchhl_spec.lua12
-rw-r--r--test/functional/ui/wildmode_spec.lua36
-rw-r--r--test/functional/viml/completion_spec.lua4
-rw-r--r--third-party/cmake/BuildUnibilium.cmake5
-rw-r--r--third-party/patches/unibilium-Relax-checks-for-extended-capability-to-support-new-.patch865
25 files changed, 1248 insertions, 185 deletions
diff --git a/src/nvim/testdir/test_escaped_glob.vim b/src/nvim/testdir/test_escaped_glob.vim
index eaeac28d61..aad3a1e835 100644
--- a/src/nvim/testdir/test_escaped_glob.vim
+++ b/src/nvim/testdir/test_escaped_glob.vim
@@ -2,8 +2,6 @@
" characters.
function SetUp()
- " make sure glob() doesn't use the shell
- set shell=doesnotexist
" consistent sorting of file names
set nofileignorecase
endfunction
@@ -14,20 +12,23 @@ function Test_glob()
" filenames. Disable the test on non-Unix systems for now.
return
endif
- call assert_equal("", glob('Xxx\{'))
- call assert_equal("", glob('Xxx\$'))
+
+ " Execute these commands in the sandbox, so that using the shell fails.
+ " Setting 'shell' to an invalid name causes a memory leak.
+ sandbox call assert_equal("", glob('Xxx\{'))
+ sandbox call assert_equal("", glob('Xxx\$'))
w! Xxx{
" } to fix highlighting
w! Xxx\$
- call assert_equal("Xxx{", glob('Xxx\{'))
- call assert_equal("Xxx$", glob('Xxx\$'))
+ sandbox call assert_equal("Xxx{", glob('Xxx\{'))
+ sandbox call assert_equal("Xxx$", glob('Xxx\$'))
call delete('Xxx{')
call delete('Xxx$')
endfunction
function Test_globpath()
- call assert_equal(expand("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim"),
+ sandbox call assert_equal(expand("sautest/autoload/globone.vim\nsautest/autoload/globtwo.vim"),
\ globpath('sautest/autoload', 'glob*.vim'))
- call assert_equal([expand('sautest/autoload/globone.vim'), expand('sautest/autoload/globtwo.vim')],
+ sandbox call assert_equal([expand('sautest/autoload/globone.vim'), expand('sautest/autoload/globtwo.vim')],
\ globpath('sautest/autoload', 'glob*.vim', 0, 1))
endfunction
diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim
index 82afeb76c8..da61751bf4 100644
--- a/src/nvim/testdir/test_timers.vim
+++ b/src/nvim/testdir/test_timers.vim
@@ -172,6 +172,41 @@ func Test_stop_all_in_callback()
call assert_equal(0, len(info))
endfunc
+func FeedkeysCb(timer)
+ call feedkeys("hello\<CR>", 'nt')
+endfunc
+
+func InputCb(timer)
+ call timer_start(10, 'FeedkeysCb')
+ let g:val = input('?')
+ call Resume()
+endfunc
+
+func Test_input_in_timer()
+ let g:val = ''
+ call timer_start(10, 'InputCb')
+ call Standby(1000)
+ call assert_equal('hello', g:val)
+endfunc
+
+func FuncWithCaughtError(timer)
+ let g:call_count += 1
+ try
+ doesnotexist
+ catch
+ " nop
+ endtry
+endfunc
+
+func Test_timer_catch_error()
+ let g:call_count = 0
+ let timer = timer_start(10, 'FuncWithCaughtError', {'repeat': 4})
+ " Timer will not be stopped.
+ call WaitFor('g:call_count == 4')
+ sleep 50m
+ call assert_equal(4, g:call_count)
+endfunc
+
func FeedAndPeek(timer)
call test_feedinput('a')
call getchar(1)
diff --git a/test/functional/api/menu_spec.lua b/test/functional/api/menu_spec.lua
index d55b7b118a..2cfa0e3e47 100644
--- a/test/functional/api/menu_spec.lua
+++ b/test/functional/api/menu_spec.lua
@@ -20,15 +20,15 @@ describe("update_menu notification", function()
end)
local function expect_sent(expected)
- screen:wait(function()
+ screen:expect{condition=function()
if screen.update_menu ~= expected then
if expected then
- return 'update_menu was expected but not sent'
+ error('update_menu was expected but not sent')
else
- return 'update_menu was sent unexpectedly'
+ error('update_menu was sent unexpectedly')
end
end
- end)
+ end, unchanged=(not expected)}
end
it("should be sent when adding a menu", function()
diff --git a/test/functional/eval/execute_spec.lua b/test/functional/eval/execute_spec.lua
index 925e311c7d..af37ab8d55 100644
--- a/test/functional/eval/execute_spec.lua
+++ b/test/functional/eval/execute_spec.lua
@@ -161,13 +161,13 @@ describe('execute()', function()
eq('42', eval('g:mes'))
command('let g:mes = execute("echon 13", "silent")')
- screen:expect([[
+ screen:expect{grid=[[
^ |
~ |
~ |
~ |
|
- ]])
+ ]], unchanged=true}
eq('13', eval('g:mes'))
end)
diff --git a/test/functional/eval/input_spec.lua b/test/functional/eval/input_spec.lua
index 777f49462d..82e75d7a8e 100644
--- a/test/functional/eval/input_spec.lua
+++ b/test/functional/eval/input_spec.lua
@@ -150,13 +150,13 @@ describe('input()', function()
{T:Foo>}Bar^ |
]])
command('redraw!')
- screen:expect([[
+ screen:expect{grid=[[
|
{EOB:~ }|
{EOB:~ }|
{EOB:~ }|
{T:Foo>}Bar^ |
- ]])
+ ]], reset=true}
feed('<BS>')
screen:expect([[
|
@@ -166,13 +166,13 @@ describe('input()', function()
{T:Foo>}Ba^ |
]])
command('redraw!')
- screen:expect([[
+ screen:expect{grid=[[
|
{EOB:~ }|
{EOB:~ }|
{EOB:~ }|
{T:Foo>}Ba^ |
- ]])
+ ]], reset=true}
end)
it('allows omitting everything with dictionary argument', function()
command('echohl Test')
@@ -348,13 +348,13 @@ describe('inputdialog()', function()
{T:Foo>}Bar^ |
]])
command('redraw!')
- screen:expect([[
+ screen:expect{grid=[[
|
{EOB:~ }|
{EOB:~ }|
{EOB:~ }|
{T:Foo>}Bar^ |
- ]])
+ ]], reset=true}
feed('<BS>')
screen:expect([[
|
@@ -364,13 +364,13 @@ describe('inputdialog()', function()
{T:Foo>}Ba^ |
]])
command('redraw!')
- screen:expect([[
+ screen:expect{grid=[[
|
{EOB:~ }|
{EOB:~ }|
{EOB:~ }|
{T:Foo>}Ba^ |
- ]])
+ ]], reset=true}
end)
it('allows omitting everything with dictionary argument', function()
command('echohl Test')
diff --git a/test/functional/eval/timer_spec.lua b/test/functional/eval/timer_spec.lua
index 040ab30522..c945f12e0e 100644
--- a/test/functional/eval/timer_spec.lua
+++ b/test/functional/eval/timer_spec.lua
@@ -113,7 +113,6 @@ describe('timers', function()
^ |
]])
- screen:sleep(200)
screen:expect([[
ITEM 1 |
ITEM 2 |
@@ -200,13 +199,14 @@ describe('timers', function()
screen:attach()
screen:set_default_attr_ids( {[0] = {bold=true, foreground=255}} )
source([[
+ let g:val = 0
func! MyHandler(timer)
echo "evil"
+ let g:val = 1
endfunc
]])
command("call timer_start(100, 'MyHandler', {'repeat': 1})")
feed(":good")
- screen:sleep(200)
screen:expect([[
|
{0:~ }|
@@ -215,6 +215,17 @@ describe('timers', function()
{0:~ }|
:good^ |
]])
+
+ screen:expect{grid=[[
+ |
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ {0:~ }|
+ :good^ |
+ ]], intermediate=true, timeout=200}
+
+ eq(1, eval('g:val'))
end)
end)
diff --git a/test/functional/legacy/008_autocommands_spec.lua b/test/functional/legacy/008_autocommands_spec.lua
index 453638ce45..939404cb5e 100644
--- a/test/functional/legacy/008_autocommands_spec.lua
+++ b/test/functional/legacy/008_autocommands_spec.lua
@@ -2,9 +2,9 @@
-- Test for BufUnload autocommand that unloads all other buffers.
local helpers = require('test.functional.helpers')(after_each)
-local feed, source = helpers.feed, helpers.source
-local clear, feed_command, expect, eq, eval = helpers.clear, helpers.feed_command, helpers.expect, helpers.eq, helpers.eval
-local write_file, wait, dedent = helpers.write_file, helpers.wait, helpers.dedent
+local source = helpers.source
+local clear, command, expect, eq, eval = helpers.clear, helpers.command, helpers.expect, helpers.eq, helpers.eval
+local write_file, dedent = helpers.write_file, helpers.dedent
local read_file = helpers.read_file
describe('autocommands that delete and unload buffers:', function()
@@ -26,29 +26,25 @@ describe('autocommands that delete and unload buffers:', function()
before_each(clear)
it('BufWritePre, BufUnload', function()
- feed_command('au BufWritePre Xxx1 bunload')
- feed_command('au BufWritePre Xxx2 bwipe')
- feed_command('e Xxx2')
+ command('au BufWritePre Xxx1 bunload')
+ command('au BufWritePre Xxx2 bwipe')
+ command('e Xxx2')
eq('Xxx2', eval('bufname("%")'))
- feed_command('e Xxx1')
+ command('e Xxx1')
eq('Xxx1', eval('bufname("%")'))
-- The legacy test file did not check the error message.
- feed_command('let v:errmsg = "no error"')
- feed_command('write')
- -- Discard all "hit enter" prompts and messages.
- feed('<C-L>')
+ command('let v:errmsg = "no error"')
+ command('silent! write')
eq('E203: Autocommands deleted or unloaded buffer to be written',
eval('v:errmsg'))
eq('Xxx2', eval('bufname("%")'))
expect(text2)
-- Start editing Xxx2.
- feed_command('e! Xxx2')
+ command('e! Xxx2')
-- The legacy test file did not check the error message.
- feed_command('let v:errmsg = "no error"')
+ command('let v:errmsg = "no error"')
-- Write Xxx2, will delete the buffer and give an error msg.
- feed_command('w')
- -- Discard all "hit enter" prompts and messages.
- feed('<C-L>')
+ command('silent! write')
eq('E203: Autocommands deleted or unloaded buffer to be written',
eval('v:errmsg'))
eq('Xxx1', eval('bufname("%")'))
@@ -75,18 +71,11 @@ describe('autocommands that delete and unload buffers:', function()
au BufUnload * call CloseAll()
au VimLeave * call WriteToOut()
]])
- feed_command('e Xxx2')
- -- Discard all "hit enter" prompts and messages.
- feed('<C-L>')
- feed_command('e Xxx1')
- -- Discard all "hit enter" prompts and messages.
- feed('<C-L>')
- feed_command('e Makefile') -- an existing file
- feed('<C-L>')
- feed_command('sp new2')
- feed('<C-L>')
- feed_command('q')
- wait()
+ command('silent! edit Xxx2')
+ command('silent! edit Xxx1')
+ command('silent! edit Makefile') -- an existing file
+ command('silent! split new2')
+ command('silent! quit')
eq('VimLeave done',
string.match(read_file(test_file), "^%s*(.-)%s*$"))
end)
diff --git a/test/functional/legacy/search_spec.lua b/test/functional/legacy/search_spec.lua
index 277d8d6c7f..3ed06a22e7 100644
--- a/test/functional/legacy/search_spec.lua
+++ b/test/functional/legacy/search_spec.lua
@@ -92,6 +92,7 @@ describe('search cmdline', function()
9 {inc:the}se |
/the^ |
]])
+ screen.bell = false
feed('<C-G>')
if wrapscan == 'wrapscan' then
screen:expect([[
@@ -100,11 +101,13 @@ describe('search cmdline', function()
/the^ |
]])
else
- screen:expect([[
+ screen:expect{grid=[[
8 them |
9 {inc:the}se |
/the^ |
- ]])
+ ]], condition=function()
+ eq(true, screen.bell)
+ end}
feed('<CR>')
eq({0, 0, 0, 0}, funcs.getpos('"'))
end
@@ -120,6 +123,7 @@ describe('search cmdline', function()
10 foobar |
?the^ |
]])
+ screen.bell = false
if wrapscan == 'wrapscan' then
feed('<C-G>')
screen:expect([[
@@ -135,11 +139,13 @@ describe('search cmdline', function()
]])
else
feed('<C-G>')
- screen:expect([[
+ screen:expect{grid=[[
9 {inc:the}se |
10 foobar |
?the^ |
- ]])
+ ]], condition=function()
+ eq(true, screen.bell)
+ end}
feed('<CR>')
screen:expect([[
9 ^these |
@@ -173,6 +179,7 @@ describe('search cmdline', function()
3 the |
?the^ |
]])
+ screen.bell = false
feed('<C-T>')
if wrapscan == 'wrapscan' then
screen:expect([[
@@ -181,11 +188,13 @@ describe('search cmdline', function()
?the^ |
]])
else
- screen:expect([[
+ screen:expect{grid=[[
2 {inc:the}se |
3 the |
?the^ |
- ]])
+ ]], condition=function()
+ eq(true, screen.bell)
+ end}
end
end
diff --git a/test/functional/normal/put_spec.lua b/test/functional/normal/put_spec.lua
index 148a35ec6b..29cef13e39 100644
--- a/test/functional/normal/put_spec.lua
+++ b/test/functional/normal/put_spec.lua
@@ -874,20 +874,23 @@ describe('put command', function()
local function bell_test(actions, should_ring)
local screen = Screen.new()
screen:attach()
+ if should_ring then
+ -- check bell is not set by nvim before the action
+ screen:sleep(50)
+ end
helpers.ok(not screen.bell and not screen.visualbell)
actions()
- helpers.wait()
- screen:wait(function()
+ screen:expect{condition=function()
if should_ring then
if not screen.bell and not screen.visualbell then
- return 'Bell was not rung after action'
+ error('Bell was not rung after action')
end
else
if screen.bell or screen.visualbell then
- return 'Bell was rung after action'
+ error('Bell was rung after action')
end
end
- end)
+ end, unchanged=(not should_ring)}
screen:detach()
end
diff --git a/test/functional/options/fillchars_spec.lua b/test/functional/options/fillchars_spec.lua
index ab61935d4c..99177a11b4 100644
--- a/test/functional/options/fillchars_spec.lua
+++ b/test/functional/options/fillchars_spec.lua
@@ -36,6 +36,13 @@ describe("'fillchars'", function()
]])
end)
it('supports whitespace', function()
+ screen:expect([[
+ ^ |
+ ~ |
+ ~ |
+ ~ |
+ |
+ ]])
command('set fillchars=eob:\\ ')
screen:expect([[
^ |
diff --git a/test/functional/terminal/scrollback_spec.lua b/test/functional/terminal/scrollback_spec.lua
index 5e36fea474..2e236327c8 100644
--- a/test/functional/terminal/scrollback_spec.lua
+++ b/test/functional/terminal/scrollback_spec.lua
@@ -426,9 +426,8 @@ describe("'scrollback' option", function()
curbufmeths.set_option('scrollback', 200)
-- Wait for prompt.
- screen:expect{any='$'}
+ screen:expect{any='%$'}
- wait()
if iswin() then
feed_data('for($i=1;$i -le 30;$i++){Write-Host \"line$i\"}\r')
else
diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua
index 834720edc6..365bd2a0be 100644
--- a/test/functional/terminal/tui_spec.lua
+++ b/test/functional/terminal/tui_spec.lua
@@ -370,7 +370,7 @@ describe('tui FocusGained/FocusLost', function()
{3:-- TERMINAL --} |
]])
feed_data('\027[O')
- screen:expect([[
+ screen:expect{grid=[[
|
{4:~ }|
{4:~ }|
@@ -378,7 +378,7 @@ describe('tui FocusGained/FocusLost', function()
{5:[No Name] }|
:{1: } |
{3:-- TERMINAL --} |
- ]])
+ ]], unchanged=true}
end)
it('in cmdline-mode', function()
diff --git a/test/functional/ui/cmdline_highlight_spec.lua b/test/functional/ui/cmdline_highlight_spec.lua
index 4db7720c2c..2eab44dc90 100644
--- a/test/functional/ui/cmdline_highlight_spec.lua
+++ b/test/functional/ui/cmdline_highlight_spec.lua
@@ -267,7 +267,7 @@ describe('Command-line coloring', function()
:echo {RBP1:(}{RBP2:(}42{RBP2:)}^ |
]])
redraw_input()
- screen:expect([[
+ screen:expect{grid=[[
|
{EOB:~ }|
{EOB:~ }|
@@ -276,7 +276,7 @@ describe('Command-line coloring', function()
{EOB:~ }|
{EOB:~ }|
:echo {RBP1:(}{RBP2:(}42{RBP2:)}^ |
- ]])
+ ]], reset=true}
end)
for _, func_part in ipairs({'', 'n', 'msg'}) do
it('disables :echo' .. func_part .. ' messages', function()
@@ -755,7 +755,7 @@ describe('Command-line coloring', function()
eq(1, meths.eval('1'))
end)
end)
-describe('Ex commands coloring support', function()
+describe('Ex commands coloring', function()
it('works', function()
meths.set_var('Nvim_color_cmdline', 'RainBowParens')
feed(':echo (((1)))')
@@ -831,7 +831,7 @@ describe('Ex commands coloring support', function()
|
]])
end)
- it('does prevent mapping error from cancelling prompt', function()
+ it('mapping error does not cancel prompt', function()
command("cnoremap <expr> x execute('throw 42')[-1]")
feed(':#x')
screen:expect([[
@@ -856,16 +856,6 @@ describe('Ex commands coloring support', function()
{PE:Press ENTER or type command to continue}^ |
]])
feed('<CR>')
- screen:expect([[
- ^ |
- {EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
- {EOB:~ }|
- |
- ]])
eq('Error detected while processing :\nE605: Exception not caught: 42\nE749: empty buffer',
meths.command_output('messages'))
end)
diff --git a/test/functional/ui/cmdline_spec.lua b/test/functional/ui/cmdline_spec.lua
index af26a6d88f..e86414fe5f 100644
--- a/test/functional/ui/cmdline_spec.lua
+++ b/test/functional/ui/cmdline_spec.lua
@@ -253,9 +253,6 @@ local function test_cmdline(linegrid)
]], cmdline=expectation}
-- erase information, so we check if it is retransmitted
- -- TODO(bfredl): when we add a flag to screen:expect{}
- -- to explicitly check redraw!, it should also do this
- screen.cmdline = {}
command("redraw!")
screen:expect{grid=[[
^ |
@@ -263,7 +260,7 @@ local function test_cmdline(linegrid)
{1:~ }|
{1:~ }|
|
- ]], cmdline=expectation}
+ ]], cmdline=expectation, reset=true}
feed('<cr>')
@@ -323,7 +320,6 @@ local function test_cmdline(linegrid)
{{' line1'}},
}}
- screen.cmdline_block = {}
command("redraw!")
screen:expect{grid=[[
^ |
@@ -339,7 +335,7 @@ local function test_cmdline(linegrid)
}}, cmdline_block = {
{{'function Foo()'}},
{{' line1'}},
- }}
+ }, reset=true}
feed('endfunction<cr>')
screen:expect{grid=[[
@@ -415,7 +411,6 @@ local function test_cmdline(linegrid)
pos = 4,
}}}
- screen.cmdline = {}
command("redraw!")
screen:expect{grid=[[
|
@@ -427,7 +422,7 @@ local function test_cmdline(linegrid)
firstc = ":",
content = {{"yank"}},
pos = 4,
- }}}
+ }}, reset=true}
feed("<c-c>")
screen:expect{grid=[[
diff --git a/test/functional/ui/highlight_spec.lua b/test/functional/ui/highlight_spec.lua
index 7f3bf3e97b..521b1e0b8a 100644
--- a/test/functional/ui/highlight_spec.lua
+++ b/test/functional/ui/highlight_spec.lua
@@ -870,7 +870,7 @@ describe("'winhighlight' highlight", function()
eq('Vim(set):E474: Invalid argument: winhl=xxx:yyy',
exc_exec("set winhl=xxx:yyy"))
eq('Normal:Background1', eval('&winhl'))
- screen:expect([[
+ screen:expect{grid=[[
{1:^ }|
{2:~ }|
{2:~ }|
@@ -879,7 +879,7 @@ describe("'winhighlight' highlight", function()
{2:~ }|
{2:~ }|
|
- ]])
+ ]], unchanged=true}
end)
diff --git a/test/functional/ui/inccommand_spec.lua b/test/functional/ui/inccommand_spec.lua
index 49b566e5a2..736a314426 100644
--- a/test/functional/ui/inccommand_spec.lua
+++ b/test/functional/ui/inccommand_spec.lua
@@ -495,6 +495,18 @@ describe(":substitute, 'inccommand' preserves undo", function()
for _, case in pairs(cases) do
clear()
common_setup(screen, case, default_text)
+ screen:expect([[
+ Inc substitution on |
+ two lines |
+ ^ |
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ |
+ ]])
feed_command("set undolevels=1")
feed("1G0")
@@ -757,8 +769,23 @@ describe(":substitute, inccommand=split", function()
-- non-modifier prefix
feed(':silent tabedit %s/tw/to')
- screen:expect{any=[[two lines]]}
- feed('<Esc>')
+ screen:expect([[
+ Inc substitution on |
+ two lines |
+ Inc substitution on |
+ two lines |
+ |
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ :silent tabedit %s/tw/to^ |
+ ]])
end)
it('shows split window when typing the pattern', function()
@@ -866,7 +893,6 @@ describe(":substitute, inccommand=split", function()
it('does not show split window for :s/', function()
feed("2gg")
feed(":s/tw")
- screen:sleep(1)
screen:expect([[
Inc substitution on |
{12:tw}o lines |
@@ -1234,8 +1260,18 @@ describe("inccommand=nosplit", function()
-- non-modifier prefix
feed(':silent tabedit %s/tw/to')
- screen:expect{any=[[two lines]]}
- feed('<Esc>')
+ screen:expect([[
+ two lines |
+ Inc substitution on |
+ two lines |
+ |
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ {15:~ }|
+ :silent tabedit %s/t|
+ w/to^ |
+ ]])
end)
it("does not show window after toggling :set inccommand", function()
@@ -1503,7 +1539,7 @@ describe("'inccommand' and :cnoremap", function()
end
end)
- it('does work with a failing mapping', function()
+ it('still works with a broken mapping', function()
for _, case in pairs(cases) do
refresh(case)
feed_command("cnoremap <expr> x execute('bwipeout!')[-1].'x'")
diff --git a/test/functional/ui/mouse_spec.lua b/test/functional/ui/mouse_spec.lua
index debd324977..ff395adeb9 100644
--- a/test/functional/ui/mouse_spec.lua
+++ b/test/functional/ui/mouse_spec.lua
@@ -168,13 +168,13 @@ describe('ui/mouse/input', function()
|
]])
feed('<LeftMouse><11,0>')
- screen:expect([[
+ screen:expect{grid=[[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
this is ba^r |
{0:~ }|
{0:~ }|
|
- ]])
+ ]], unchanged=true}
feed('<LeftDrag><6,0>')
screen:expect([[
{sel: + bar }{tab: + foo }{fill: }{tab:X}|
@@ -236,13 +236,13 @@ describe('ui/mouse/input', function()
|
]])
feed('<LeftDrag><4,1>')
- screen:expect([[
+ screen:expect{grid=[[
{sel: + foo }{tab: + bar }{fill: }{tab:X}|
this is fo^o |
{0:~ }|
{0:~ }|
|
- ]])
+ ]], unchanged=true}
feed('<LeftDrag><14,1>')
screen:expect([[
{tab: + bar }{sel: + foo }{fill: }{tab:X}|
@@ -254,13 +254,6 @@ describe('ui/mouse/input', function()
end)
it('out of tabline to the left moves tab left', function()
- if helpers.skip_fragile(pending,
- os.getenv("TRAVIS") and (helpers.os_name() == "osx"
- or os.getenv("CLANG_SANITIZER") == "ASAN_UBSAN")) -- #4874
- then
- return
- end
-
feed_command('%delete')
insert('this is foo')
feed_command('silent file foo | tabnew | file bar')
@@ -273,21 +266,21 @@ describe('ui/mouse/input', function()
|
]])
feed('<LeftMouse><11,0>')
- screen:expect([[
+ screen:expect{grid=[[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
this is ba^r |
{0:~ }|
{0:~ }|
|
- ]])
+ ]], unchanged=true}
feed('<LeftDrag><11,1>')
- screen:expect([[
+ screen:expect{grid=[[
{tab: + foo }{sel: + bar }{fill: }{tab:X}|
this is ba^r |
{0:~ }|
{0:~ }|
|
- ]])
+ ]], unchanged=true}
feed('<LeftDrag><6,1>')
screen:expect([[
{sel: + bar }{tab: + foo }{fill: }{tab:X}|
@@ -319,13 +312,13 @@ describe('ui/mouse/input', function()
|
]])
feed('<LeftDrag><4,1>')
- screen:expect([[
+ screen:expect{grid=[[
{sel: + foo }{tab: + bar }{fill: }{tab:X}|
this is fo^o |
{0:~ }|
{0:~ }|
|
- ]])
+ ]], unchanged=true}
feed('<LeftDrag><7,1>')
screen:expect([[
{tab: + bar }{sel: + foo }{fill: }{tab:X}|
diff --git a/test/functional/ui/output_spec.lua b/test/functional/ui/output_spec.lua
index 0f076eac26..1850d436ac 100644
--- a/test/functional/ui/output_spec.lua
+++ b/test/functional/ui/output_spec.lua
@@ -51,25 +51,20 @@ describe("shell command :!", function()
end)
it("throttles shell-command output greater than ~10KB", function()
- if os.getenv("TRAVIS") and helpers.os_name() == "osx" then
- pending("[Unreliable on Travis macOS.]", function() end)
- return
- end
-
- screen.timeout = 20000 -- Avoid false failure on slow systems.
child_session.feed_data(
- ":!for i in $(seq 2 3000); do echo XXXXXXXXXX $i; done\n")
+ ":!for i in $(seq 2 30000); do echo XXXXXXXXXX $i; done\n")
-- If we observe any line starting with a dot, then throttling occurred.
- screen:expect{any="\n."}
+ -- Avoid false failure on slow systems.
+ screen:expect{any="\n%.", timeout=20000}
-- Final chunk of output should always be displayed, never skipped.
-- (Throttling is non-deterministic, this test is merely a sanity check.)
screen:expect([[
- XXXXXXXXXX 2997 |
- XXXXXXXXXX 2998 |
- XXXXXXXXXX 2999 |
- XXXXXXXXXX 3000 |
+ XXXXXXXXXX 29997 |
+ XXXXXXXXXX 29998 |
+ XXXXXXXXXX 29999 |
+ XXXXXXXXXX 30000 |
|
{10:Press ENTER or type command to continue}{1: } |
{3:-- TERMINAL --} |
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua
index 691bf9f64c..af036913d8 100644
--- a/test/functional/ui/screen.lua
+++ b/test/functional/ui/screen.lua
@@ -89,15 +89,17 @@ Screen.__index = Screen
local debug_screen
-local default_screen_timeout = 3500
+local default_timeout_factor = 1
if os.getenv('VALGRIND') then
- default_screen_timeout = default_screen_timeout * 3
+ default_timeout_factor = default_timeout_factor * 3
end
if os.getenv('CI') then
- default_screen_timeout = default_screen_timeout * 3
+ default_timeout_factor = default_timeout_factor * 3
end
+local default_screen_timeout = default_timeout_factor * 3500
+
do
local spawn, nvim_prog = helpers.spawn, helpers.nvim_prog
local session = spawn({nvim_prog, '-u', 'NONE', '-i', 'NONE', '-N', '--embed'})
@@ -160,12 +162,13 @@ function Screen.new(width, height)
_attr_table = {[0]={{},{}}},
_clear_attrs = {},
_new_attrs = false,
+ _width = width,
+ _height = height,
_cursor = {
row = 1, col = 1
},
_busy = false
}, Screen)
- self:_handle_resize(width, height)
return self
end
@@ -190,6 +193,7 @@ function Screen:attach(options)
end
self._options = options
self._clear_attrs = (options.ext_linegrid and {{},{}}) or {}
+ self:_handle_resize(self._width, self._height)
uimeths.attach(self._width, self._height, options)
if self._options.rgb == nil then
-- nvim defaults to rgb=true internally,
@@ -243,8 +247,27 @@ local ext_keys = {
-- nothing is ignored.
-- condition: Function asserting some arbitrary condition. Return value is
-- ignored, throw an error (use eq() or similar) to signal failure.
--- any: Lua pattern string expected to match a screen line.
+-- any: Lua pattern string expected to match a screen line. NB: the
+-- following chars are magic characters
+-- ( ) . % + - * ? [ ^ $
+-- and must be escaped with a preceding % for a literal match.
-- mode: Expected mode as signaled by "mode_change" event
+-- unchanged: Test that the screen state is unchanged since the previous
+-- expect(...). Any flush event resulting in a different state is
+-- considered an error. Not observing any events until timeout
+-- is acceptable.
+-- intermediate:Test that the final state is the same as the previous expect,
+-- but expect an intermediate state that is different. If possible
+-- it is better to use an explicit screen:expect(...) for this
+-- intermediate state.
+-- reset: Reset the state internal to the test Screen before starting to
+-- receive updates. This should be used after command("redraw!")
+-- or some other mechanism that will invoke "redraw!", to check
+-- that all screen state is transmitted again. This includes
+-- state related to ext_ features as mentioned below.
+-- timeout: maximum time that will be waited until the expected state is
+-- seen (or maximum time to observe an incorrect change when
+-- `unchanged` flag is used)
--
-- The following keys should be used to expect the state of various ext_
-- features. Note that an absent key will assert that the item is currently
@@ -262,7 +285,8 @@ function Screen:expect(expected, attr_ids, attr_ignore)
if type(expected) == "table" then
assert(not (attr_ids ~= nil or attr_ignore ~= nil))
local is_key = {grid=true, attr_ids=true, attr_ignore=true, condition=true,
- any=true, mode=true}
+ any=true, mode=true, unchanged=true, intermediate=true,
+ reset=true, timeout=true}
for _, v in ipairs(ext_keys) do
is_key[v] = true
end
@@ -304,7 +328,7 @@ function Screen:expect(expected, attr_ids, attr_ignore)
attr_state.id_to_index = self:hlstate_check_attrs(attr_state.ids or {})
end
self._new_attrs = false
- self:wait(function()
+ self:_wait(function()
if condition ~= nil then
local status, res = pcall(condition)
if not status then
@@ -361,7 +385,7 @@ screen:redraw_debug() to show all intermediate screen states. ]])
-- Extension features. The default expectations should cover the case of
-- the ext_ feature being disabled, or the feature currently not activated
-- (for instance no external cmdline visible). Some extensions require
- -- preprocessing to prepresent highlights in a reproducible way.
+ -- preprocessing to represent highlights in a reproducible way.
local extstate = self:_extstate_repr(attr_state)
-- convert assertion errors into invalid screen state descriptions
@@ -379,14 +403,48 @@ screen:redraw_debug() to show all intermediate screen states. ]])
if not status then
return tostring(res)
end
- end)
+ end, expected)
end
-function Screen:wait(check, timeout)
- local err, checked = false
+function Screen:_wait(check, flags)
+ local err, checked = false, false
local success_seen = false
local failure_after_success = false
local did_flush = true
+ local warn_immediate = not (flags.unchanged or flags.intermediate)
+
+ if flags.intermediate and flags.unchanged then
+ error("Choose only one of 'intermediate' and 'unchanged', not both")
+ end
+
+ if flags.reset then
+ -- throw away all state, we expect it to be retransmitted
+ self:_reset()
+ end
+
+ -- Maximum timeout, after which a incorrect state will be regarded as a
+ -- failure
+ local timeout = flags.timeout or self.timeout
+
+ -- Minimal timeout before the loop is allowed to be stopped so we
+ -- always do some check for failure after success.
+ local minimal_timeout = default_timeout_factor * 2
+
+ local immediate_seen, intermediate_seen = false, false
+ if not check() then
+ minimal_timeout = default_timeout_factor * 20
+ immediate_seen = true
+ end
+
+ -- for an unchanged test, flags.timeout means the time during the state is
+ -- expected to be unchanged, so always wait this full time.
+ if (flags.unchanged or flags.intermediate) and flags.timeout ~= nil then
+ minimal_timeout = timeout
+ end
+
+ assert(timeout >= minimal_timeout)
+ local did_miminal_timeout = false
+
local function notification_cb(method, args)
assert(method == 'redraw')
did_flush = self:_redraw(args)
@@ -395,9 +453,15 @@ function Screen:wait(check, timeout)
end
err = check()
checked = true
+ if err and immediate_seen then
+ intermediate_seen = true
+ end
+
if not err then
success_seen = true
- helpers.stop()
+ if did_miminal_timeout then
+ helpers.stop()
+ end
elseif success_seen and #args > 0 then
failure_after_success = true
--print(require('inspect')(args))
@@ -405,35 +469,83 @@ function Screen:wait(check, timeout)
return true
end
- run(nil, notification_cb, nil, timeout or self.timeout)
+ run(nil, notification_cb, nil, minimal_timeout)
if not did_flush then
err = "no flush received"
elseif not checked then
err = check()
+ if not err and flags.unchanged then
+ -- expecting NO screen change: use a shorter timout
+ success_seen = true
+ end
+ end
+
+ if not success_seen then
+ did_miminal_timeout = true
+ run(nil, notification_cb, nil, timeout-minimal_timeout)
+ end
+
+ local did_warn = false
+ if warn_immediate and immediate_seen then
+ print([[
+
+Warning: A screen test has immediate success. Try to avoid this unless the
+purpose of the test really requires it.]])
+ if intermediate_seen then
+ print([[
+There are intermediate states between the two identical expects.
+Use screen:snapshot_util() or screen:redraw_debug() to find them, and add them
+to the test if they make sense.
+]])
+ else
+ print([[If necessary, silence this warning by
+supplying the 'unchanged' argument to screen:expect.]])
+ end
+ did_warn = true
end
if failure_after_success then
print([[
Warning: Screen changes were received after the expected state. This indicates
-indeterminism in the test. Try adding wait() (or screen:expect(...)) between
+indeterminism in the test. Try adding screen:expect(...) (or wait()) between
asynchronous (feed(), nvim_input()) and synchronous API calls.
- - Use Screen:redraw_debug() to investigate the problem.
+ - Use Screen:redraw_debug() to investigate the problem. It might find
+ relevant intermediate states that should be added to the test to make it
+ more robust.
+ - If the point of the test is to assert the state after some user input
+ sent with feed(...), also adding an screen:expect(...) before the feed(...)
+ will help ensure the input is sent to nvim when nvim is in a predictable
+ state. This is preferable to using wait(), as it is more closely emulates
+ real user interaction.
- wait() can trigger redraws and consequently generate more indeterminism.
In that case try removing every wait().
]])
+ did_warn = true
+ end
+
+
+ if err then
+ assert(false, err)
+ elseif did_warn then
local tb = debug.traceback()
local index = string.find(tb, '\n%s*%[C]')
print(string.sub(tb,1,index))
end
- if err then
- assert(false, err)
+ if flags.intermediate then
+ assert(intermediate_seen, "expected intermediate screen state before final screen state")
+ elseif flags.unchanged then
+ assert(not intermediate_seen, "expected screen state to be unchanged")
end
end
function Screen:sleep(ms)
- pcall(function() self:wait(function() return "error" end, ms) end)
+ local function notification_cb(method, args)
+ assert(method == 'redraw')
+ self:_redraw(args)
+ end
+ run(nil, notification_cb, nil, ms)
end
function Screen:_redraw(updates)
@@ -486,12 +598,23 @@ end
function Screen:_handle_flush()
end
-
function Screen:_handle_grid_resize(grid, width, height)
assert(grid == 1)
self:_handle_resize(width, height)
end
+function Screen:_reset()
+ -- TODO: generalize to multigrid later
+ self:_handle_grid_clear(1)
+
+ -- TODO: share with initialization, so it generalizes?
+ self.popupmenu = nil
+ self.cmdline = {}
+ self.cmdline_block = {}
+ self.wildmenu_items = nil
+ self.wildmenu_pos = nil
+end
+
function Screen:_handle_mode_info_set(cursor_style_enabled, mode_info)
self._cursor_style_enabled = cursor_style_enabled
diff --git a/test/functional/ui/screen_basic_spec.lua b/test/functional/ui/screen_basic_spec.lua
index 31825bdbf4..3e930b0ae7 100644
--- a/test/functional/ui/screen_basic_spec.lua
+++ b/test/functional/ui/screen_basic_spec.lua
@@ -394,7 +394,7 @@ local function screen_tests(linegrid)
end)
it('redraws properly with :tab split right after scroll', function()
- feed('30Ofoo<esc>gg')
+ feed('15Ofoo<esc>15Obar<esc>gg')
command('vsplit')
screen:expect([[
@@ -420,18 +420,17 @@ local function screen_tests(linegrid)
foo {3:│}foo |
foo {3:│}foo |
foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
- foo {3:│}foo |
+ bar {3:│}foo |
+ bar {3:│}foo |
+ bar {3:│}foo |
+ bar {3:│}foo |
+ bar {3:│}foo |
+ bar {3:│}foo |
+ bar {3:│}foo |
+ bar {3:│}foo |
{1:[No Name] [+] }{3:[No Name] [+] }|
|
]])
-
command('tab split')
screen:expect([[
{4: }{5:2}{4:+ [No Name] }{2: + [No Name] }{3: }{4:X}|
@@ -439,14 +438,14 @@ local function screen_tests(linegrid)
foo |
foo |
foo |
- foo |
- foo |
- foo |
- foo |
- foo |
- foo |
- foo |
- foo |
+ bar |
+ bar |
+ bar |
+ bar |
+ bar |
+ bar |
+ bar |
+ bar |
|
]])
end)
diff --git a/test/functional/ui/searchhl_spec.lua b/test/functional/ui/searchhl_spec.lua
index b535092ab9..a46670d8a2 100644
--- a/test/functional/ui/searchhl_spec.lua
+++ b/test/functional/ui/searchhl_spec.lua
@@ -324,7 +324,17 @@ describe('search highlighting', function()
]])
-- same, for C-t
- feed('<ESC>/<C-t>')
+ feed('<ESC>')
+ screen:expect([[
+ the first line |
+ in a ^little file |
+ |
+ {1:~ }|
+ {1:~ }|
+ {1:~ }|
+ |
+ ]])
+ feed('/<C-t>')
screen:expect([[
the first line |
in a little file |
diff --git a/test/functional/ui/wildmode_spec.lua b/test/functional/ui/wildmode_spec.lua
index 72dbef9538..8931d9245b 100644
--- a/test/functional/ui/wildmode_spec.lua
+++ b/test/functional/ui/wildmode_spec.lua
@@ -1,3 +1,5 @@
+local global_helpers = require('test.helpers')
+local shallowcopy = global_helpers.shallowcopy
local helpers = require('test.functional.helpers')(after_each)
local Screen = require('test.functional.ui.screen')
local clear, feed, command = helpers.clear, helpers.feed, helpers.command
@@ -18,6 +20,14 @@ describe("'wildmenu'", function()
screen:detach()
end)
+ -- expect the screen stayed unchanged some time after first seen success
+ local function expect_stay_unchanged(args)
+ screen:expect(args)
+ args = shallowcopy(args)
+ args.unchanged = true
+ screen:expect(args)
+ end
+
it(':sign <tab> shows wildmenu completions', function()
command('set wildmode=full')
command('set wildmenu')
@@ -76,10 +86,6 @@ describe("'wildmenu'", function()
end)
it('is preserved during :terminal activity', function()
- -- Because this test verifies a _lack_ of activity after screen:sleep(), we
- -- must wait the full timeout. So make it reasonable.
- screen.timeout = 1000
-
command('set wildmenu wildmode=full')
command('set scrollback=4')
if iswin() then
@@ -90,26 +96,24 @@ describe("'wildmenu'", function()
feed([[<C-\><C-N>gg]])
feed([[:sign <Tab>]]) -- Invoke wildmenu.
- screen:sleep(50) -- Allow some terminal output.
- screen:expect([[
+ expect_stay_unchanged{grid=[[
foo |
foo |
foo |
define jump list > |
:sign define^ |
- ]])
+ ]]}
-- cmdline CTRL-D display should also be preserved.
feed([[<C-\><C-N>]])
feed([[:sign <C-D>]]) -- Invoke cmdline CTRL-D.
- screen:sleep(50) -- Allow some terminal output.
- screen:expect([[
+ expect_stay_unchanged{grid=[[
:sign |
define place |
jump undefine |
list unplace |
:sign ^ |
- ]])
+ ]]}
-- Exiting cmdline should show the buffer.
feed([[<C-\><C-N>]])
@@ -123,22 +127,17 @@ describe("'wildmenu'", function()
end)
it('ignores :redrawstatus called from a timer #7108', function()
- -- Because this test verifies a _lack_ of activity after screen:sleep(), we
- -- must wait the full timeout. So make it reasonable.
- screen.timeout = 1000
-
command('set wildmenu wildmode=full')
command([[call timer_start(10, {->execute('redrawstatus')}, {'repeat':-1})]])
feed([[<C-\><C-N>]])
feed([[:sign <Tab>]]) -- Invoke wildmenu.
- screen:sleep(30) -- Allow some timer activity.
- screen:expect([[
+ expect_stay_unchanged{grid=[[
|
~ |
~ |
define jump list > |
:sign define^ |
- ]])
+ ]]}
end)
it('with laststatus=0, :vsplit, :term #2255', function()
@@ -164,10 +163,9 @@ describe("'wildmenu'", function()
feed([[<C-\><C-N>]])
feed([[:<Tab>]]) -- Invoke wildmenu.
- screen:sleep(10) -- Flush
-- Check only the last 2 lines, because the shell output is
-- system-dependent.
- screen:expect{any='! # & < = > @ > \n:!^'}
+ expect_stay_unchanged{any='! # & < = > @ > \n:!^'}
end)
end)
diff --git a/test/functional/viml/completion_spec.lua b/test/functional/viml/completion_spec.lua
index 3222e5783d..70b4717c32 100644
--- a/test/functional/viml/completion_spec.lua
+++ b/test/functional/viml/completion_spec.lua
@@ -757,7 +757,7 @@ describe('completion', function()
eval('1 + 1')
-- popupmenu still visible
- screen:expect([[
+ screen:expect{grid=[[
foobar fooegg |
fooegg^ |
{1:foobar }{0: }|
@@ -766,7 +766,7 @@ describe('completion', function()
{0:~ }|
{0:~ }|
{3:-- Keyword completion (^N^P) }{4:match 1 of 2} |
- ]])
+ ]], unchanged=true}
feed('<c-p>')
-- Didn't restart completion: old matches still used
diff --git a/third-party/cmake/BuildUnibilium.cmake b/third-party/cmake/BuildUnibilium.cmake
index f5342e3d34..9b7f0364a9 100644
--- a/third-party/cmake/BuildUnibilium.cmake
+++ b/third-party/cmake/BuildUnibilium.cmake
@@ -11,6 +11,9 @@ if(WIN32)
-DTARGET=unibilium
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
+ PATCH_COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/unibilium init
+ COMMAND ${GIT_EXECUTABLE} -C ${DEPS_BUILD_DIR}/src/unibilium apply --ignore-whitespace
+ ${CMAKE_CURRENT_SOURCE_DIR}/patches/unibilium-Relax-checks-for-extended-capability-to-support-new-.patch
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/cmake/UnibiliumCMakeLists.txt
${DEPS_BUILD_DIR}/src/unibilium/CMakeLists.txt
@@ -38,6 +41,8 @@ else()
-DTARGET=unibilium
-DUSE_EXISTING_SRC_DIR=${USE_EXISTING_SRC_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/DownloadAndExtractFile.cmake
+ PATCH_COMMAND patch -d ${DEPS_BUILD_DIR}/src/unibilium -Np1 --input
+ ${CMAKE_CURRENT_SOURCE_DIR}/patches/unibilium-Relax-checks-for-extended-capability-to-support-new-.patch
CONFIGURE_COMMAND ""
BUILD_IN_SOURCE 1
BUILD_COMMAND ${MAKE_PRG} CC=${DEPS_C_COMPILER}
diff --git a/third-party/patches/unibilium-Relax-checks-for-extended-capability-to-support-new-.patch b/third-party/patches/unibilium-Relax-checks-for-extended-capability-to-support-new-.patch
new file mode 100644
index 0000000000..e7976d66d1
--- /dev/null
+++ b/third-party/patches/unibilium-Relax-checks-for-extended-capability-to-support-new-.patch
@@ -0,0 +1,865 @@
+From 9ba283bf2d3c1b96f5811e2091397fcc7d383e3b Mon Sep 17 00:00:00 2001
+From: James McCoy <jamessan@jamessan.com>
+Date: Sun, 22 Jul 2018 23:08:40 -0400
+Subject: [PATCH] Relax checks for extended capability to support new format
+
+In the 20180331 release, the format was slightly changed:
+
+> 20180331
+> + improve terminfo write/read by modifying the fourth item of the
+> extended header to denote the number of valid strings in the extended
+> string table (prompted by a comment in unibilium's sources).
+
+Since the number of valid string capabilities is not necessarily the
+same as extstrslen, it's not possible to sanity check the total number
+of items up front anymore.
+
+Include a new test with an updated screen terminfo dump.
+---
+ t/new-extended-format-static_screen.c | 820 ++++++++++++++++++++++++++
+ unibilium.c | 2 -
+ 2 files changed, 820 insertions(+), 2 deletions(-)
+ create mode 100644 t/new-extended-format-static_screen.c
+
+diff --git a/t/new-extended-format-static_screen.c b/t/new-extended-format-static_screen.c
+new file mode 100644
+index 0000000..c5c4872
+--- /dev/null
++++ b/t/new-extended-format-static_screen.c
+@@ -0,0 +1,820 @@
++#include <unibilium.h>
++#include <errno.h>
++#include <string.h>
++#include "test-simple.c.inc"
++
++static const char terminfo[] = {
++ 26, 1, 42, 0, 43, 0, 15, 0, 105, 1, -103, 2, 115, 99, 114, 101, 101, 110, 124, 86,
++ 84, 32, 49, 48, 48, 47, 65, 78, 83, 73, 32, 88, 51, 46, 54, 52, 32, 118, 105, 114,
++ 116, 117, 97, 108, 32, 116, 101, 114, 109, 105, 110, 97, 108, 0, 0, 1, 0, 0, 1, 0,
++ 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
++ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 80, 0,
++ 8, 0, 24, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, 8, 0, 64, 0, 0, 0, 4, 0, 6, 0, 8, 0, 25, 0, 30, 0,
++ 37, 0, 41, 0, 45, 0, -1, -1, 56, 0, 73, 0, 75, 0, 79, 0, 86, 0, -1, -1,
++ 88, 0, 100, 0, -1, -1, 104, 0, 107, 0, 113, 0, 117, 0, -1, -1, -1, -1, 121, 0,
++ 123, 0, -128, 0, -123, 0, -1, -1, -114, 0, -109, 0, -1, -1, -1, -1, -104, 0, -99, 0,
++ -94, 0, -1, -1, -89, 0, -87, 0, -82, 0, -1, -1, -73, 0, -68, 0, -62, 0, -56, 0,
++ -1, -1, -1, -1, -1, -1, -53, 0, -1, -1, -1, -1, -1, -1, -49, 0, -1, -1, -45, 0,
++ -1, -1, -1, -1, -1, -1, -43, 0, -1, -1, -38, 0, -1, -1, -1, -1, -1, -1, -1, -1,
++ -34, 0, -30, 0, -24, 0, -20, 0, -16, 0, -12, 0, -6, 0, 0, 1, 6, 1, 12, 1,
++ 18, 1, 23, 1, -1, -1, 28, 1, -1, -1, 32, 1, 37, 1, 42, 1, -1, -1, -1, -1,
++ -1, -1, 46, 1, 50, 1, 58, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, 1, -1, -1, 69, 1,
++ 78, 1, 87, 1, 96, 1, 105, 1, 114, 1, 123, 1, -124, 1, -1, -1, -115, 1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -106, 1, -1, -1, -1, -1,
++ -89, 1, -86, 1, -75, 1, -72, 1, -70, 1, -67, 1, 17, 2, -1, -1, 20, 2, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ 22, 2, -1, -1, 87, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 91, 2,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, 2, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ 103, 2, 109, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, 115, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, 120, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -127, 2,
++ -1, -1, -1, -1, -1, -1, -123, 2, -113, 2, 27, 91, 90, 0, 7, 0, 13, 0, 27, 91,
++ 37, 105, 37, 112, 49, 37, 100, 59, 37, 112, 50, 37, 100, 114, 0, 27, 91, 51, 103, 0,
++ 27, 91, 72, 27, 91, 74, 0, 27, 91, 75, 0, 27, 91, 74, 0, 27, 91, 37, 105, 37,
++ 112, 49, 37, 100, 71, 0, 27, 91, 37, 105, 37, 112, 49, 37, 100, 59, 37, 112, 50, 37,
++ 100, 72, 0, 10, 0, 27, 91, 72, 0, 27, 91, 63, 50, 53, 108, 0, 8, 0, 27, 91,
++ 51, 52, 104, 27, 91, 63, 50, 53, 104, 0, 27, 91, 67, 0, 27, 77, 0, 27, 91, 51,
++ 52, 108, 0, 27, 91, 80, 0, 27, 91, 77, 0, 14, 0, 27, 91, 53, 109, 0, 27, 91,
++ 49, 109, 0, 27, 91, 63, 49, 48, 52, 57, 104, 0, 27, 91, 50, 109, 0, 27, 91, 52,
++ 104, 0, 27, 91, 55, 109, 0, 27, 91, 51, 109, 0, 27, 91, 52, 109, 0, 15, 0, 27,
++ 91, 109, 15, 0, 27, 91, 63, 49, 48, 52, 57, 108, 0, 27, 91, 52, 108, 0, 27, 91,
++ 50, 51, 109, 0, 27, 91, 50, 52, 109, 0, 27, 103, 0, 27, 41, 48, 0, 27, 91, 76,
++ 0, 127, 0, 27, 91, 51, 126, 0, 27, 79, 66, 0, 27, 79, 80, 0, 27, 91, 50, 49,
++ 126, 0, 27, 79, 81, 0, 27, 79, 82, 0, 27, 79, 83, 0, 27, 91, 49, 53, 126, 0,
++ 27, 91, 49, 55, 126, 0, 27, 91, 49, 56, 126, 0, 27, 91, 49, 57, 126, 0, 27, 91,
++ 50, 48, 126, 0, 27, 91, 49, 126, 0, 27, 91, 50, 126, 0, 27, 79, 68, 0, 27, 91,
++ 54, 126, 0, 27, 91, 53, 126, 0, 27, 79, 67, 0, 27, 79, 65, 0, 27, 91, 63, 49,
++ 108, 27, 62, 0, 27, 91, 63, 49, 104, 27, 61, 0, 27, 69, 0, 27, 91, 37, 112, 49,
++ 37, 100, 80, 0, 27, 91, 37, 112, 49, 37, 100, 77, 0, 27, 91, 37, 112, 49, 37, 100,
++ 66, 0, 27, 91, 37, 112, 49, 37, 100, 64, 0, 27, 91, 37, 112, 49, 37, 100, 83, 0,
++ 27, 91, 37, 112, 49, 37, 100, 76, 0, 27, 91, 37, 112, 49, 37, 100, 68, 0, 27, 91,
++ 37, 112, 49, 37, 100, 67, 0, 27, 91, 37, 112, 49, 37, 100, 65, 0, 27, 99, 27, 91,
++ 63, 49, 48, 48, 48, 108, 27, 91, 63, 50, 53, 104, 0, 27, 56, 0, 27, 91, 37, 105,
++ 37, 112, 49, 37, 100, 100, 0, 27, 55, 0, 10, 0, 27, 77, 0, 27, 91, 48, 37, 63,
++ 37, 112, 54, 37, 116, 59, 49, 37, 59, 37, 63, 37, 112, 49, 37, 116, 59, 51, 37, 59,
++ 37, 63, 37, 112, 50, 37, 116, 59, 52, 37, 59, 37, 63, 37, 112, 51, 37, 116, 59, 55,
++ 37, 59, 37, 63, 37, 112, 52, 37, 116, 59, 53, 37, 59, 37, 63, 37, 112, 53, 37, 116,
++ 59, 50, 37, 59, 109, 37, 63, 37, 112, 57, 37, 116, 14, 37, 101, 15, 37, 59, 0, 27,
++ 72, 0, 9, 0, 43, 43, 44, 44, 45, 45, 46, 46, 48, 48, 96, 96, 97, 97, 102, 102,
++ 103, 103, 104, 104, 105, 105, 106, 106, 107, 107, 108, 108, 109, 109, 110, 110, 111, 111, 112, 112,
++ 113, 113, 114, 114, 115, 115, 116, 116, 117, 117, 118, 118, 119, 119, 120, 120, 121, 121, 122, 122,
++ 123, 123, 124, 124, 125, 125, 126, 126, 0, 27, 91, 90, 0, 27, 40, 66, 27, 41, 48, 0,
++ 27, 91, 52, 126, 0, 27, 91, 50, 51, 126, 0, 27, 91, 50, 52, 126, 0, 27, 91, 49,
++ 75, 0, 27, 91, 51, 57, 59, 52, 57, 109, 0, 27, 91, 77, 0, 27, 91, 51, 37, 112,
++ 49, 37, 100, 109, 0, 27, 91, 52, 37, 112, 49, 37, 100, 109, 0, 0, 3, 0, 1, 0,
++ 12, 0, 28, 0, 70, 0, 1, 1, 0, 0, 1, 0, 0, 0, -1, -1, 4, 0, -1, -1,
++ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, 3, 0,
++ 6, 0, 9, 0, 12, 0, 15, 0, 18, 0, 21, 0, 24, 0, 27, 0, 33, 0, 39, 0,
++ 43, 0, 47, 0, 51, 0, 55, 0, 27, 40, 66, 0, 27, 40, 37, 112, 49, 37, 99, 0,
++ 65, 88, 0, 71, 48, 0, 88, 84, 0, 85, 56, 0, 69, 48, 0, 69, 51, 0, 83, 48,
++ 0, 84, 83, 0, 88, 77, 0, 107, 69, 78, 68, 53, 0, 107, 72, 79, 77, 53, 0, 107,
++ 97, 50, 0, 107, 98, 49, 0, 107, 98, 51, 0, 107, 99, 50, 0, 120, 109, 0
++};
++
++static void setup(void);
++
++int main(void) {
++ int e;
++ unibi_term *dt;
++
++ setup();
++
++ dt = unibi_dummy();
++ e = errno;
++ ok(dt != NULL, "dummy constructed");
++ if (!dt) {
++ bail_out(strerror(e));
++ }
++ unibi_term *ut = unibi_from_mem(terminfo, sizeof terminfo);
++ e = errno;
++ ok(ut != NULL, "terminfo loaded");
++ if (!ut) {
++ bail_out(strerror(e));
++ }
++
++ note("terminal name");
++ ok(strcmp(unibi_get_name(ut), "VT 100/ANSI X3.64 virtual terminal") == 0, "terminal name = \"%s\"", "VT 100/ANSI X3.64 virtual terminal");
++ unibi_set_name(dt, "VT 100/ANSI X3.64 virtual terminal");
++ {
++ static const char *def_aliases[] = {"screen", NULL};
++ const char **aliases = unibi_get_aliases(ut);
++ ok(strcmp(aliases[0], def_aliases[0]) == 0, "terminal alias #0 = \"%s\"", "screen");
++ ok(aliases[1] == NULL, "terminal alias #1 = null");
++ unibi_set_aliases(dt, def_aliases);
++ }
++
++ note("boolean capabilities");
++ ok(unibi_get_bool(ut, unibi_auto_left_margin) == 0, "auto_left_margin = false");
++ ok(unibi_get_bool(ut, unibi_auto_right_margin) == 1, "auto_right_margin = true");
++ unibi_set_bool(dt, unibi_auto_right_margin, 1);
++ ok(unibi_get_bool(ut, unibi_no_esc_ctlc) == 0, "no_esc_ctlc = false");
++ ok(unibi_get_bool(ut, unibi_ceol_standout_glitch) == 0, "ceol_standout_glitch = false");
++ ok(unibi_get_bool(ut, unibi_eat_newline_glitch) == 1, "eat_newline_glitch = true");
++ unibi_set_bool(dt, unibi_eat_newline_glitch, 1);
++ ok(unibi_get_bool(ut, unibi_erase_overstrike) == 0, "erase_overstrike = false");
++ ok(unibi_get_bool(ut, unibi_generic_type) == 0, "generic_type = false");
++ ok(unibi_get_bool(ut, unibi_hard_copy) == 0, "hard_copy = false");
++ ok(unibi_get_bool(ut, unibi_has_meta_key) == 1, "has_meta_key = true");
++ unibi_set_bool(dt, unibi_has_meta_key, 1);
++ ok(unibi_get_bool(ut, unibi_has_status_line) == 0, "has_status_line = false");
++ ok(unibi_get_bool(ut, unibi_insert_null_glitch) == 0, "insert_null_glitch = false");
++ ok(unibi_get_bool(ut, unibi_memory_above) == 0, "memory_above = false");
++ ok(unibi_get_bool(ut, unibi_memory_below) == 0, "memory_below = false");
++ ok(unibi_get_bool(ut, unibi_move_insert_mode) == 1, "move_insert_mode = true");
++ unibi_set_bool(dt, unibi_move_insert_mode, 1);
++ ok(unibi_get_bool(ut, unibi_move_standout_mode) == 1, "move_standout_mode = true");
++ unibi_set_bool(dt, unibi_move_standout_mode, 1);
++ ok(unibi_get_bool(ut, unibi_over_strike) == 0, "over_strike = false");
++ ok(unibi_get_bool(ut, unibi_status_line_esc_ok) == 0, "status_line_esc_ok = false");
++ ok(unibi_get_bool(ut, unibi_dest_tabs_magic_smso) == 0, "dest_tabs_magic_smso = false");
++ ok(unibi_get_bool(ut, unibi_tilde_glitch) == 0, "tilde_glitch = false");
++ ok(unibi_get_bool(ut, unibi_transparent_underline) == 0, "transparent_underline = false");
++ ok(unibi_get_bool(ut, unibi_xon_xoff) == 0, "xon_xoff = false");
++ ok(unibi_get_bool(ut, unibi_needs_xon_xoff) == 0, "needs_xon_xoff = false");
++ ok(unibi_get_bool(ut, unibi_prtr_silent) == 0, "prtr_silent = false");
++ ok(unibi_get_bool(ut, unibi_hard_cursor) == 0, "hard_cursor = false");
++ ok(unibi_get_bool(ut, unibi_non_rev_rmcup) == 0, "non_rev_rmcup = false");
++ ok(unibi_get_bool(ut, unibi_no_pad_char) == 0, "no_pad_char = false");
++ ok(unibi_get_bool(ut, unibi_non_dest_scroll_region) == 0, "non_dest_scroll_region = false");
++ ok(unibi_get_bool(ut, unibi_can_change) == 0, "can_change = false");
++ ok(unibi_get_bool(ut, unibi_back_color_erase) == 0, "back_color_erase = false");
++ ok(unibi_get_bool(ut, unibi_hue_lightness_saturation) == 0, "hue_lightness_saturation = false");
++ ok(unibi_get_bool(ut, unibi_col_addr_glitch) == 0, "col_addr_glitch = false");
++ ok(unibi_get_bool(ut, unibi_cr_cancels_micro_mode) == 0, "cr_cancels_micro_mode = false");
++ ok(unibi_get_bool(ut, unibi_has_print_wheel) == 0, "has_print_wheel = false");
++ ok(unibi_get_bool(ut, unibi_row_addr_glitch) == 0, "row_addr_glitch = false");
++ ok(unibi_get_bool(ut, unibi_semi_auto_right_margin) == 0, "semi_auto_right_margin = false");
++ ok(unibi_get_bool(ut, unibi_cpi_changes_res) == 0, "cpi_changes_res = false");
++ ok(unibi_get_bool(ut, unibi_lpi_changes_res) == 0, "lpi_changes_res = false");
++ ok(unibi_get_bool(ut, unibi_backspaces_with_bs) == 1, "backspaces_with_bs = true");
++ unibi_set_bool(dt, unibi_backspaces_with_bs, 1);
++ ok(unibi_get_bool(ut, unibi_crt_no_scrolling) == 0, "crt_no_scrolling = false");
++ ok(unibi_get_bool(ut, unibi_no_correctly_working_cr) == 0, "no_correctly_working_cr = false");
++ ok(unibi_get_bool(ut, unibi_gnu_has_meta_key) == 0, "gnu_has_meta_key = false");
++ ok(unibi_get_bool(ut, unibi_linefeed_is_newline) == 0, "linefeed_is_newline = false");
++ ok(unibi_get_bool(ut, unibi_has_hardware_tabs) == 1, "has_hardware_tabs = true");
++ unibi_set_bool(dt, unibi_has_hardware_tabs, 1);
++ ok(unibi_get_bool(ut, unibi_return_does_clr_eol) == 0, "return_does_clr_eol = false");
++
++ note("numeric capabilities");
++ ok(unibi_get_num(ut, unibi_columns) == 80, "columns = 80");
++ unibi_set_num(dt, unibi_columns, 80);
++ ok(unibi_get_num(ut, unibi_init_tabs) == 8, "init_tabs = 8");
++ unibi_set_num(dt, unibi_init_tabs, 8);
++ ok(unibi_get_num(ut, unibi_lines) == 24, "lines = 24");
++ unibi_set_num(dt, unibi_lines, 24);
++ ok(unibi_get_num(ut, unibi_lines_of_memory) == -1, "lines_of_memory = -1");
++ ok(unibi_get_num(ut, unibi_magic_cookie_glitch) == -1, "magic_cookie_glitch = -1");
++ ok(unibi_get_num(ut, unibi_padding_baud_rate) == -1, "padding_baud_rate = -1");
++ ok(unibi_get_num(ut, unibi_virtual_terminal) == -1, "virtual_terminal = -1");
++ ok(unibi_get_num(ut, unibi_width_status_line) == -1, "width_status_line = -1");
++ ok(unibi_get_num(ut, unibi_num_labels) == -1, "num_labels = -1");
++ ok(unibi_get_num(ut, unibi_label_height) == -1, "label_height = -1");
++ ok(unibi_get_num(ut, unibi_label_width) == -1, "label_width = -1");
++ ok(unibi_get_num(ut, unibi_max_attributes) == -1, "max_attributes = -1");
++ ok(unibi_get_num(ut, unibi_maximum_windows) == -1, "maximum_windows = -1");
++ ok(unibi_get_num(ut, unibi_max_colors) == 8, "max_colors = 8");
++ unibi_set_num(dt, unibi_max_colors, 8);
++ ok(unibi_get_num(ut, unibi_max_pairs) == 64, "max_pairs = 64");
++ unibi_set_num(dt, unibi_max_pairs, 64);
++ ok(unibi_get_num(ut, unibi_no_color_video) == -1, "no_color_video = -1");
++ ok(unibi_get_num(ut, unibi_buffer_capacity) == -1, "buffer_capacity = -1");
++ ok(unibi_get_num(ut, unibi_dot_vert_spacing) == -1, "dot_vert_spacing = -1");
++ ok(unibi_get_num(ut, unibi_dot_horz_spacing) == -1, "dot_horz_spacing = -1");
++ ok(unibi_get_num(ut, unibi_max_micro_address) == -1, "max_micro_address = -1");
++ ok(unibi_get_num(ut, unibi_max_micro_jump) == -1, "max_micro_jump = -1");
++ ok(unibi_get_num(ut, unibi_micro_col_size) == -1, "micro_col_size = -1");
++ ok(unibi_get_num(ut, unibi_micro_line_size) == -1, "micro_line_size = -1");
++ ok(unibi_get_num(ut, unibi_number_of_pins) == -1, "number_of_pins = -1");
++ ok(unibi_get_num(ut, unibi_output_res_char) == -1, "output_res_char = -1");
++ ok(unibi_get_num(ut, unibi_output_res_line) == -1, "output_res_line = -1");
++ ok(unibi_get_num(ut, unibi_output_res_horz_inch) == -1, "output_res_horz_inch = -1");
++ ok(unibi_get_num(ut, unibi_output_res_vert_inch) == -1, "output_res_vert_inch = -1");
++ ok(unibi_get_num(ut, unibi_print_rate) == -1, "print_rate = -1");
++ ok(unibi_get_num(ut, unibi_wide_char_size) == -1, "wide_char_size = -1");
++ ok(unibi_get_num(ut, unibi_buttons) == -1, "buttons = -1");
++ ok(unibi_get_num(ut, unibi_bit_image_entwining) == -1, "bit_image_entwining = -1");
++ ok(unibi_get_num(ut, unibi_bit_image_type) == -1, "bit_image_type = -1");
++ ok(unibi_get_num(ut, unibi_magic_cookie_glitch_ul) == -1, "magic_cookie_glitch_ul = -1");
++ ok(unibi_get_num(ut, unibi_carriage_return_delay) == -1, "carriage_return_delay = -1");
++ ok(unibi_get_num(ut, unibi_new_line_delay) == -1, "new_line_delay = -1");
++ ok(unibi_get_num(ut, unibi_backspace_delay) == -1, "backspace_delay = -1");
++ ok(unibi_get_num(ut, unibi_horizontal_tab_delay) == -1, "horizontal_tab_delay = -1");
++ ok(unibi_get_num(ut, unibi_number_of_function_keys) == -1, "number_of_function_keys = -1");
++
++ note("string capabilities");
++ ok(strcmp(unibi_get_str(ut, unibi_back_tab), "\033[Z") == 0, "back_tab = \"%s\"", "\\033[Z");
++ unibi_set_str(dt, unibi_back_tab, "\033[Z");
++ ok(strcmp(unibi_get_str(ut, unibi_bell), "\007") == 0, "bell = \"%s\"", "\\007");
++ unibi_set_str(dt, unibi_bell, "\007");
++ ok(strcmp(unibi_get_str(ut, unibi_carriage_return), "\015") == 0, "carriage_return = \"%s\"", "\\015");
++ unibi_set_str(dt, unibi_carriage_return, "\015");
++ ok(strcmp(unibi_get_str(ut, unibi_change_scroll_region), "\033[%i%p1%d;%p2%dr") == 0, "change_scroll_region = \"%s\"", "\\033[%i%p1%d;%p2%dr");
++ unibi_set_str(dt, unibi_change_scroll_region, "\033[%i%p1%d;%p2%dr");
++ ok(strcmp(unibi_get_str(ut, unibi_clear_all_tabs), "\033[3g") == 0, "clear_all_tabs = \"%s\"", "\\033[3g");
++ unibi_set_str(dt, unibi_clear_all_tabs, "\033[3g");
++ ok(strcmp(unibi_get_str(ut, unibi_clear_screen), "\033[H\033[J") == 0, "clear_screen = \"%s\"", "\\033[H\\033[J");
++ unibi_set_str(dt, unibi_clear_screen, "\033[H\033[J");
++ ok(strcmp(unibi_get_str(ut, unibi_clr_eol), "\033[K") == 0, "clr_eol = \"%s\"", "\\033[K");
++ unibi_set_str(dt, unibi_clr_eol, "\033[K");
++ ok(strcmp(unibi_get_str(ut, unibi_clr_eos), "\033[J") == 0, "clr_eos = \"%s\"", "\\033[J");
++ unibi_set_str(dt, unibi_clr_eos, "\033[J");
++ ok(strcmp(unibi_get_str(ut, unibi_column_address), "\033[%i%p1%dG") == 0, "column_address = \"%s\"", "\\033[%i%p1%dG");
++ unibi_set_str(dt, unibi_column_address, "\033[%i%p1%dG");
++ ok(unibi_get_str(ut, unibi_command_character) == NULL, "command_character = null");
++ ok(strcmp(unibi_get_str(ut, unibi_cursor_address), "\033[%i%p1%d;%p2%dH") == 0, "cursor_address = \"%s\"", "\\033[%i%p1%d;%p2%dH");
++ unibi_set_str(dt, unibi_cursor_address, "\033[%i%p1%d;%p2%dH");
++ ok(strcmp(unibi_get_str(ut, unibi_cursor_down), "\012") == 0, "cursor_down = \"%s\"", "\\012");
++ unibi_set_str(dt, unibi_cursor_down, "\012");
++ ok(strcmp(unibi_get_str(ut, unibi_cursor_home), "\033[H") == 0, "cursor_home = \"%s\"", "\\033[H");
++ unibi_set_str(dt, unibi_cursor_home, "\033[H");
++ ok(strcmp(unibi_get_str(ut, unibi_cursor_invisible), "\033[?25l") == 0, "cursor_invisible = \"%s\"", "\\033[?25l");
++ unibi_set_str(dt, unibi_cursor_invisible, "\033[?25l");
++ ok(strcmp(unibi_get_str(ut, unibi_cursor_left), "\010") == 0, "cursor_left = \"%s\"", "\\010");
++ unibi_set_str(dt, unibi_cursor_left, "\010");
++ ok(unibi_get_str(ut, unibi_cursor_mem_address) == NULL, "cursor_mem_address = null");
++ ok(strcmp(unibi_get_str(ut, unibi_cursor_normal), "\033[34h\033[?25h") == 0, "cursor_normal = \"%s\"", "\\033[34h\\033[?25h");
++ unibi_set_str(dt, unibi_cursor_normal, "\033[34h\033[?25h");
++ ok(strcmp(unibi_get_str(ut, unibi_cursor_right), "\033[C") == 0, "cursor_right = \"%s\"", "\\033[C");
++ unibi_set_str(dt, unibi_cursor_right, "\033[C");
++ ok(unibi_get_str(ut, unibi_cursor_to_ll) == NULL, "cursor_to_ll = null");
++ ok(strcmp(unibi_get_str(ut, unibi_cursor_up), "\033M") == 0, "cursor_up = \"%s\"", "\\033M");
++ unibi_set_str(dt, unibi_cursor_up, "\033M");
++ ok(strcmp(unibi_get_str(ut, unibi_cursor_visible), "\033[34l") == 0, "cursor_visible = \"%s\"", "\\033[34l");
++ unibi_set_str(dt, unibi_cursor_visible, "\033[34l");
++ ok(strcmp(unibi_get_str(ut, unibi_delete_character), "\033[P") == 0, "delete_character = \"%s\"", "\\033[P");
++ unibi_set_str(dt, unibi_delete_character, "\033[P");
++ ok(strcmp(unibi_get_str(ut, unibi_delete_line), "\033[M") == 0, "delete_line = \"%s\"", "\\033[M");
++ unibi_set_str(dt, unibi_delete_line, "\033[M");
++ ok(unibi_get_str(ut, unibi_dis_status_line) == NULL, "dis_status_line = null");
++ ok(unibi_get_str(ut, unibi_down_half_line) == NULL, "down_half_line = null");
++ ok(strcmp(unibi_get_str(ut, unibi_enter_alt_charset_mode), "\016") == 0, "enter_alt_charset_mode = \"%s\"", "\\016");
++ unibi_set_str(dt, unibi_enter_alt_charset_mode, "\016");
++ ok(strcmp(unibi_get_str(ut, unibi_enter_blink_mode), "\033[5m") == 0, "enter_blink_mode = \"%s\"", "\\033[5m");
++ unibi_set_str(dt, unibi_enter_blink_mode, "\033[5m");
++ ok(strcmp(unibi_get_str(ut, unibi_enter_bold_mode), "\033[1m") == 0, "enter_bold_mode = \"%s\"", "\\033[1m");
++ unibi_set_str(dt, unibi_enter_bold_mode, "\033[1m");
++ ok(strcmp(unibi_get_str(ut, unibi_enter_ca_mode), "\033[?1049h") == 0, "enter_ca_mode = \"%s\"", "\\033[?1049h");
++ unibi_set_str(dt, unibi_enter_ca_mode, "\033[?1049h");
++ ok(unibi_get_str(ut, unibi_enter_delete_mode) == NULL, "enter_delete_mode = null");
++ ok(strcmp(unibi_get_str(ut, unibi_enter_dim_mode), "\033[2m") == 0, "enter_dim_mode = \"%s\"", "\\033[2m");
++ unibi_set_str(dt, unibi_enter_dim_mode, "\033[2m");
++ ok(strcmp(unibi_get_str(ut, unibi_enter_insert_mode), "\033[4h") == 0, "enter_insert_mode = \"%s\"", "\\033[4h");
++ unibi_set_str(dt, unibi_enter_insert_mode, "\033[4h");
++ ok(unibi_get_str(ut, unibi_enter_secure_mode) == NULL, "enter_secure_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_protected_mode) == NULL, "enter_protected_mode = null");
++ ok(strcmp(unibi_get_str(ut, unibi_enter_reverse_mode), "\033[7m") == 0, "enter_reverse_mode = \"%s\"", "\\033[7m");
++ unibi_set_str(dt, unibi_enter_reverse_mode, "\033[7m");
++ ok(strcmp(unibi_get_str(ut, unibi_enter_standout_mode), "\033[3m") == 0, "enter_standout_mode = \"%s\"", "\\033[3m");
++ unibi_set_str(dt, unibi_enter_standout_mode, "\033[3m");
++ ok(strcmp(unibi_get_str(ut, unibi_enter_underline_mode), "\033[4m") == 0, "enter_underline_mode = \"%s\"", "\\033[4m");
++ unibi_set_str(dt, unibi_enter_underline_mode, "\033[4m");
++ ok(unibi_get_str(ut, unibi_erase_chars) == NULL, "erase_chars = null");
++ ok(strcmp(unibi_get_str(ut, unibi_exit_alt_charset_mode), "\017") == 0, "exit_alt_charset_mode = \"%s\"", "\\017");
++ unibi_set_str(dt, unibi_exit_alt_charset_mode, "\017");
++ ok(strcmp(unibi_get_str(ut, unibi_exit_attribute_mode), "\033[m\017") == 0, "exit_attribute_mode = \"%s\"", "\\033[m\\017");
++ unibi_set_str(dt, unibi_exit_attribute_mode, "\033[m\017");
++ ok(strcmp(unibi_get_str(ut, unibi_exit_ca_mode), "\033[?1049l") == 0, "exit_ca_mode = \"%s\"", "\\033[?1049l");
++ unibi_set_str(dt, unibi_exit_ca_mode, "\033[?1049l");
++ ok(unibi_get_str(ut, unibi_exit_delete_mode) == NULL, "exit_delete_mode = null");
++ ok(strcmp(unibi_get_str(ut, unibi_exit_insert_mode), "\033[4l") == 0, "exit_insert_mode = \"%s\"", "\\033[4l");
++ unibi_set_str(dt, unibi_exit_insert_mode, "\033[4l");
++ ok(strcmp(unibi_get_str(ut, unibi_exit_standout_mode), "\033[23m") == 0, "exit_standout_mode = \"%s\"", "\\033[23m");
++ unibi_set_str(dt, unibi_exit_standout_mode, "\033[23m");
++ ok(strcmp(unibi_get_str(ut, unibi_exit_underline_mode), "\033[24m") == 0, "exit_underline_mode = \"%s\"", "\\033[24m");
++ unibi_set_str(dt, unibi_exit_underline_mode, "\033[24m");
++ ok(strcmp(unibi_get_str(ut, unibi_flash_screen), "\033g") == 0, "flash_screen = \"%s\"", "\\033g");
++ unibi_set_str(dt, unibi_flash_screen, "\033g");
++ ok(unibi_get_str(ut, unibi_form_feed) == NULL, "form_feed = null");
++ ok(unibi_get_str(ut, unibi_from_status_line) == NULL, "from_status_line = null");
++ ok(unibi_get_str(ut, unibi_init_1string) == NULL, "init_1string = null");
++ ok(strcmp(unibi_get_str(ut, unibi_init_2string), "\033)0") == 0, "init_2string = \"%s\"", "\\033)0");
++ unibi_set_str(dt, unibi_init_2string, "\033)0");
++ ok(unibi_get_str(ut, unibi_init_3string) == NULL, "init_3string = null");
++ ok(unibi_get_str(ut, unibi_init_file) == NULL, "init_file = null");
++ ok(unibi_get_str(ut, unibi_insert_character) == NULL, "insert_character = null");
++ ok(strcmp(unibi_get_str(ut, unibi_insert_line), "\033[L") == 0, "insert_line = \"%s\"", "\\033[L");
++ unibi_set_str(dt, unibi_insert_line, "\033[L");
++ ok(unibi_get_str(ut, unibi_insert_padding) == NULL, "insert_padding = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_backspace), "\177") == 0, "key_backspace = \"%s\"", "\\177");
++ unibi_set_str(dt, unibi_key_backspace, "\177");
++ ok(unibi_get_str(ut, unibi_key_catab) == NULL, "key_catab = null");
++ ok(unibi_get_str(ut, unibi_key_clear) == NULL, "key_clear = null");
++ ok(unibi_get_str(ut, unibi_key_ctab) == NULL, "key_ctab = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_dc), "\033[3~") == 0, "key_dc = \"%s\"", "\\033[3~");
++ unibi_set_str(dt, unibi_key_dc, "\033[3~");
++ ok(unibi_get_str(ut, unibi_key_dl) == NULL, "key_dl = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_down), "\033OB") == 0, "key_down = \"%s\"", "\\033OB");
++ unibi_set_str(dt, unibi_key_down, "\033OB");
++ ok(unibi_get_str(ut, unibi_key_eic) == NULL, "key_eic = null");
++ ok(unibi_get_str(ut, unibi_key_eol) == NULL, "key_eol = null");
++ ok(unibi_get_str(ut, unibi_key_eos) == NULL, "key_eos = null");
++ ok(unibi_get_str(ut, unibi_key_f0) == NULL, "key_f0 = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f1), "\033OP") == 0, "key_f1 = \"%s\"", "\\033OP");
++ unibi_set_str(dt, unibi_key_f1, "\033OP");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f10), "\033[21~") == 0, "key_f10 = \"%s\"", "\\033[21~");
++ unibi_set_str(dt, unibi_key_f10, "\033[21~");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f2), "\033OQ") == 0, "key_f2 = \"%s\"", "\\033OQ");
++ unibi_set_str(dt, unibi_key_f2, "\033OQ");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f3), "\033OR") == 0, "key_f3 = \"%s\"", "\\033OR");
++ unibi_set_str(dt, unibi_key_f3, "\033OR");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f4), "\033OS") == 0, "key_f4 = \"%s\"", "\\033OS");
++ unibi_set_str(dt, unibi_key_f4, "\033OS");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f5), "\033[15~") == 0, "key_f5 = \"%s\"", "\\033[15~");
++ unibi_set_str(dt, unibi_key_f5, "\033[15~");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f6), "\033[17~") == 0, "key_f6 = \"%s\"", "\\033[17~");
++ unibi_set_str(dt, unibi_key_f6, "\033[17~");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f7), "\033[18~") == 0, "key_f7 = \"%s\"", "\\033[18~");
++ unibi_set_str(dt, unibi_key_f7, "\033[18~");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f8), "\033[19~") == 0, "key_f8 = \"%s\"", "\\033[19~");
++ unibi_set_str(dt, unibi_key_f8, "\033[19~");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f9), "\033[20~") == 0, "key_f9 = \"%s\"", "\\033[20~");
++ unibi_set_str(dt, unibi_key_f9, "\033[20~");
++ ok(strcmp(unibi_get_str(ut, unibi_key_home), "\033[1~") == 0, "key_home = \"%s\"", "\\033[1~");
++ unibi_set_str(dt, unibi_key_home, "\033[1~");
++ ok(strcmp(unibi_get_str(ut, unibi_key_ic), "\033[2~") == 0, "key_ic = \"%s\"", "\\033[2~");
++ unibi_set_str(dt, unibi_key_ic, "\033[2~");
++ ok(unibi_get_str(ut, unibi_key_il) == NULL, "key_il = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_left), "\033OD") == 0, "key_left = \"%s\"", "\\033OD");
++ unibi_set_str(dt, unibi_key_left, "\033OD");
++ ok(unibi_get_str(ut, unibi_key_ll) == NULL, "key_ll = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_npage), "\033[6~") == 0, "key_npage = \"%s\"", "\\033[6~");
++ unibi_set_str(dt, unibi_key_npage, "\033[6~");
++ ok(strcmp(unibi_get_str(ut, unibi_key_ppage), "\033[5~") == 0, "key_ppage = \"%s\"", "\\033[5~");
++ unibi_set_str(dt, unibi_key_ppage, "\033[5~");
++ ok(strcmp(unibi_get_str(ut, unibi_key_right), "\033OC") == 0, "key_right = \"%s\"", "\\033OC");
++ unibi_set_str(dt, unibi_key_right, "\033OC");
++ ok(unibi_get_str(ut, unibi_key_sf) == NULL, "key_sf = null");
++ ok(unibi_get_str(ut, unibi_key_sr) == NULL, "key_sr = null");
++ ok(unibi_get_str(ut, unibi_key_stab) == NULL, "key_stab = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_up), "\033OA") == 0, "key_up = \"%s\"", "\\033OA");
++ unibi_set_str(dt, unibi_key_up, "\033OA");
++ ok(strcmp(unibi_get_str(ut, unibi_keypad_local), "\033[?1l\033>") == 0, "keypad_local = \"%s\"", "\\033[?1l\\033>");
++ unibi_set_str(dt, unibi_keypad_local, "\033[?1l\033>");
++ ok(strcmp(unibi_get_str(ut, unibi_keypad_xmit), "\033[?1h\033=") == 0, "keypad_xmit = \"%s\"", "\\033[?1h\\033=");
++ unibi_set_str(dt, unibi_keypad_xmit, "\033[?1h\033=");
++ ok(unibi_get_str(ut, unibi_lab_f0) == NULL, "lab_f0 = null");
++ ok(unibi_get_str(ut, unibi_lab_f1) == NULL, "lab_f1 = null");
++ ok(unibi_get_str(ut, unibi_lab_f10) == NULL, "lab_f10 = null");
++ ok(unibi_get_str(ut, unibi_lab_f2) == NULL, "lab_f2 = null");
++ ok(unibi_get_str(ut, unibi_lab_f3) == NULL, "lab_f3 = null");
++ ok(unibi_get_str(ut, unibi_lab_f4) == NULL, "lab_f4 = null");
++ ok(unibi_get_str(ut, unibi_lab_f5) == NULL, "lab_f5 = null");
++ ok(unibi_get_str(ut, unibi_lab_f6) == NULL, "lab_f6 = null");
++ ok(unibi_get_str(ut, unibi_lab_f7) == NULL, "lab_f7 = null");
++ ok(unibi_get_str(ut, unibi_lab_f8) == NULL, "lab_f8 = null");
++ ok(unibi_get_str(ut, unibi_lab_f9) == NULL, "lab_f9 = null");
++ ok(unibi_get_str(ut, unibi_meta_off) == NULL, "meta_off = null");
++ ok(unibi_get_str(ut, unibi_meta_on) == NULL, "meta_on = null");
++ ok(strcmp(unibi_get_str(ut, unibi_newline), "\033E") == 0, "newline = \"%s\"", "\\033E");
++ unibi_set_str(dt, unibi_newline, "\033E");
++ ok(unibi_get_str(ut, unibi_pad_char) == NULL, "pad_char = null");
++ ok(strcmp(unibi_get_str(ut, unibi_parm_dch), "\033[%p1%dP") == 0, "parm_dch = \"%s\"", "\\033[%p1%dP");
++ unibi_set_str(dt, unibi_parm_dch, "\033[%p1%dP");
++ ok(strcmp(unibi_get_str(ut, unibi_parm_delete_line), "\033[%p1%dM") == 0, "parm_delete_line = \"%s\"", "\\033[%p1%dM");
++ unibi_set_str(dt, unibi_parm_delete_line, "\033[%p1%dM");
++ ok(strcmp(unibi_get_str(ut, unibi_parm_down_cursor), "\033[%p1%dB") == 0, "parm_down_cursor = \"%s\"", "\\033[%p1%dB");
++ unibi_set_str(dt, unibi_parm_down_cursor, "\033[%p1%dB");
++ ok(strcmp(unibi_get_str(ut, unibi_parm_ich), "\033[%p1%d@") == 0, "parm_ich = \"%s\"", "\\033[%p1%d@");
++ unibi_set_str(dt, unibi_parm_ich, "\033[%p1%d@");
++ ok(strcmp(unibi_get_str(ut, unibi_parm_index), "\033[%p1%dS") == 0, "parm_index = \"%s\"", "\\033[%p1%dS");
++ unibi_set_str(dt, unibi_parm_index, "\033[%p1%dS");
++ ok(strcmp(unibi_get_str(ut, unibi_parm_insert_line), "\033[%p1%dL") == 0, "parm_insert_line = \"%s\"", "\\033[%p1%dL");
++ unibi_set_str(dt, unibi_parm_insert_line, "\033[%p1%dL");
++ ok(strcmp(unibi_get_str(ut, unibi_parm_left_cursor), "\033[%p1%dD") == 0, "parm_left_cursor = \"%s\"", "\\033[%p1%dD");
++ unibi_set_str(dt, unibi_parm_left_cursor, "\033[%p1%dD");
++ ok(strcmp(unibi_get_str(ut, unibi_parm_right_cursor), "\033[%p1%dC") == 0, "parm_right_cursor = \"%s\"", "\\033[%p1%dC");
++ unibi_set_str(dt, unibi_parm_right_cursor, "\033[%p1%dC");
++ ok(unibi_get_str(ut, unibi_parm_rindex) == NULL, "parm_rindex = null");
++ ok(strcmp(unibi_get_str(ut, unibi_parm_up_cursor), "\033[%p1%dA") == 0, "parm_up_cursor = \"%s\"", "\\033[%p1%dA");
++ unibi_set_str(dt, unibi_parm_up_cursor, "\033[%p1%dA");
++ ok(unibi_get_str(ut, unibi_pkey_key) == NULL, "pkey_key = null");
++ ok(unibi_get_str(ut, unibi_pkey_local) == NULL, "pkey_local = null");
++ ok(unibi_get_str(ut, unibi_pkey_xmit) == NULL, "pkey_xmit = null");
++ ok(unibi_get_str(ut, unibi_print_screen) == NULL, "print_screen = null");
++ ok(unibi_get_str(ut, unibi_prtr_off) == NULL, "prtr_off = null");
++ ok(unibi_get_str(ut, unibi_prtr_on) == NULL, "prtr_on = null");
++ ok(unibi_get_str(ut, unibi_repeat_char) == NULL, "repeat_char = null");
++ ok(unibi_get_str(ut, unibi_reset_1string) == NULL, "reset_1string = null");
++ ok(strcmp(unibi_get_str(ut, unibi_reset_2string), "\033c\033[?1000l\033[?25h") == 0, "reset_2string = \"%s\"", "\\033c\\033[?1000l\\033[?25h");
++ unibi_set_str(dt, unibi_reset_2string, "\033c\033[?1000l\033[?25h");
++ ok(unibi_get_str(ut, unibi_reset_3string) == NULL, "reset_3string = null");
++ ok(unibi_get_str(ut, unibi_reset_file) == NULL, "reset_file = null");
++ ok(strcmp(unibi_get_str(ut, unibi_restore_cursor), "\0338") == 0, "restore_cursor = \"%s\"", "\\0338");
++ unibi_set_str(dt, unibi_restore_cursor, "\0338");
++ ok(strcmp(unibi_get_str(ut, unibi_row_address), "\033[%i%p1%dd") == 0, "row_address = \"%s\"", "\\033[%i%p1%dd");
++ unibi_set_str(dt, unibi_row_address, "\033[%i%p1%dd");
++ ok(strcmp(unibi_get_str(ut, unibi_save_cursor), "\0337") == 0, "save_cursor = \"%s\"", "\\0337");
++ unibi_set_str(dt, unibi_save_cursor, "\0337");
++ ok(strcmp(unibi_get_str(ut, unibi_scroll_forward), "\012") == 0, "scroll_forward = \"%s\"", "\\012");
++ unibi_set_str(dt, unibi_scroll_forward, "\012");
++ ok(strcmp(unibi_get_str(ut, unibi_scroll_reverse), "\033M") == 0, "scroll_reverse = \"%s\"", "\\033M");
++ unibi_set_str(dt, unibi_scroll_reverse, "\033M");
++ ok(strcmp(unibi_get_str(ut, unibi_set_attributes), "\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;") == 0, "set_attributes = \"%s\"", "\\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;m%?%p9%t\\016%e\\017%;");
++ unibi_set_str(dt, unibi_set_attributes, "\033[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;");
++ ok(strcmp(unibi_get_str(ut, unibi_set_tab), "\033H") == 0, "set_tab = \"%s\"", "\\033H");
++ unibi_set_str(dt, unibi_set_tab, "\033H");
++ ok(unibi_get_str(ut, unibi_set_window) == NULL, "set_window = null");
++ ok(strcmp(unibi_get_str(ut, unibi_tab), "\011") == 0, "tab = \"%s\"", "\\011");
++ unibi_set_str(dt, unibi_tab, "\011");
++ ok(unibi_get_str(ut, unibi_to_status_line) == NULL, "to_status_line = null");
++ ok(unibi_get_str(ut, unibi_underline_char) == NULL, "underline_char = null");
++ ok(unibi_get_str(ut, unibi_up_half_line) == NULL, "up_half_line = null");
++ ok(unibi_get_str(ut, unibi_init_prog) == NULL, "init_prog = null");
++ ok(unibi_get_str(ut, unibi_key_a1) == NULL, "key_a1 = null");
++ ok(unibi_get_str(ut, unibi_key_a3) == NULL, "key_a3 = null");
++ ok(unibi_get_str(ut, unibi_key_b2) == NULL, "key_b2 = null");
++ ok(unibi_get_str(ut, unibi_key_c1) == NULL, "key_c1 = null");
++ ok(unibi_get_str(ut, unibi_key_c3) == NULL, "key_c3 = null");
++ ok(unibi_get_str(ut, unibi_prtr_non) == NULL, "prtr_non = null");
++ ok(unibi_get_str(ut, unibi_char_padding) == NULL, "char_padding = null");
++ ok(strcmp(unibi_get_str(ut, unibi_acs_chars), "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~") == 0, "acs_chars = \"%s\"", "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~");
++ unibi_set_str(dt, unibi_acs_chars, "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~");
++ ok(unibi_get_str(ut, unibi_plab_norm) == NULL, "plab_norm = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_btab), "\033[Z") == 0, "key_btab = \"%s\"", "\\033[Z");
++ unibi_set_str(dt, unibi_key_btab, "\033[Z");
++ ok(unibi_get_str(ut, unibi_enter_xon_mode) == NULL, "enter_xon_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_xon_mode) == NULL, "exit_xon_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_am_mode) == NULL, "enter_am_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_am_mode) == NULL, "exit_am_mode = null");
++ ok(unibi_get_str(ut, unibi_xon_character) == NULL, "xon_character = null");
++ ok(unibi_get_str(ut, unibi_xoff_character) == NULL, "xoff_character = null");
++ ok(strcmp(unibi_get_str(ut, unibi_ena_acs), "\033(B\033)0") == 0, "ena_acs = \"%s\"", "\\033(B\\033)0");
++ unibi_set_str(dt, unibi_ena_acs, "\033(B\033)0");
++ ok(unibi_get_str(ut, unibi_label_on) == NULL, "label_on = null");
++ ok(unibi_get_str(ut, unibi_label_off) == NULL, "label_off = null");
++ ok(unibi_get_str(ut, unibi_key_beg) == NULL, "key_beg = null");
++ ok(unibi_get_str(ut, unibi_key_cancel) == NULL, "key_cancel = null");
++ ok(unibi_get_str(ut, unibi_key_close) == NULL, "key_close = null");
++ ok(unibi_get_str(ut, unibi_key_command) == NULL, "key_command = null");
++ ok(unibi_get_str(ut, unibi_key_copy) == NULL, "key_copy = null");
++ ok(unibi_get_str(ut, unibi_key_create) == NULL, "key_create = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_end), "\033[4~") == 0, "key_end = \"%s\"", "\\033[4~");
++ unibi_set_str(dt, unibi_key_end, "\033[4~");
++ ok(unibi_get_str(ut, unibi_key_enter) == NULL, "key_enter = null");
++ ok(unibi_get_str(ut, unibi_key_exit) == NULL, "key_exit = null");
++ ok(unibi_get_str(ut, unibi_key_find) == NULL, "key_find = null");
++ ok(unibi_get_str(ut, unibi_key_help) == NULL, "key_help = null");
++ ok(unibi_get_str(ut, unibi_key_mark) == NULL, "key_mark = null");
++ ok(unibi_get_str(ut, unibi_key_message) == NULL, "key_message = null");
++ ok(unibi_get_str(ut, unibi_key_move) == NULL, "key_move = null");
++ ok(unibi_get_str(ut, unibi_key_next) == NULL, "key_next = null");
++ ok(unibi_get_str(ut, unibi_key_open) == NULL, "key_open = null");
++ ok(unibi_get_str(ut, unibi_key_options) == NULL, "key_options = null");
++ ok(unibi_get_str(ut, unibi_key_previous) == NULL, "key_previous = null");
++ ok(unibi_get_str(ut, unibi_key_print) == NULL, "key_print = null");
++ ok(unibi_get_str(ut, unibi_key_redo) == NULL, "key_redo = null");
++ ok(unibi_get_str(ut, unibi_key_reference) == NULL, "key_reference = null");
++ ok(unibi_get_str(ut, unibi_key_refresh) == NULL, "key_refresh = null");
++ ok(unibi_get_str(ut, unibi_key_replace) == NULL, "key_replace = null");
++ ok(unibi_get_str(ut, unibi_key_restart) == NULL, "key_restart = null");
++ ok(unibi_get_str(ut, unibi_key_resume) == NULL, "key_resume = null");
++ ok(unibi_get_str(ut, unibi_key_save) == NULL, "key_save = null");
++ ok(unibi_get_str(ut, unibi_key_suspend) == NULL, "key_suspend = null");
++ ok(unibi_get_str(ut, unibi_key_undo) == NULL, "key_undo = null");
++ ok(unibi_get_str(ut, unibi_key_sbeg) == NULL, "key_sbeg = null");
++ ok(unibi_get_str(ut, unibi_key_scancel) == NULL, "key_scancel = null");
++ ok(unibi_get_str(ut, unibi_key_scommand) == NULL, "key_scommand = null");
++ ok(unibi_get_str(ut, unibi_key_scopy) == NULL, "key_scopy = null");
++ ok(unibi_get_str(ut, unibi_key_screate) == NULL, "key_screate = null");
++ ok(unibi_get_str(ut, unibi_key_sdc) == NULL, "key_sdc = null");
++ ok(unibi_get_str(ut, unibi_key_sdl) == NULL, "key_sdl = null");
++ ok(unibi_get_str(ut, unibi_key_select) == NULL, "key_select = null");
++ ok(unibi_get_str(ut, unibi_key_send) == NULL, "key_send = null");
++ ok(unibi_get_str(ut, unibi_key_seol) == NULL, "key_seol = null");
++ ok(unibi_get_str(ut, unibi_key_sexit) == NULL, "key_sexit = null");
++ ok(unibi_get_str(ut, unibi_key_sfind) == NULL, "key_sfind = null");
++ ok(unibi_get_str(ut, unibi_key_shelp) == NULL, "key_shelp = null");
++ ok(unibi_get_str(ut, unibi_key_shome) == NULL, "key_shome = null");
++ ok(unibi_get_str(ut, unibi_key_sic) == NULL, "key_sic = null");
++ ok(unibi_get_str(ut, unibi_key_sleft) == NULL, "key_sleft = null");
++ ok(unibi_get_str(ut, unibi_key_smessage) == NULL, "key_smessage = null");
++ ok(unibi_get_str(ut, unibi_key_smove) == NULL, "key_smove = null");
++ ok(unibi_get_str(ut, unibi_key_snext) == NULL, "key_snext = null");
++ ok(unibi_get_str(ut, unibi_key_soptions) == NULL, "key_soptions = null");
++ ok(unibi_get_str(ut, unibi_key_sprevious) == NULL, "key_sprevious = null");
++ ok(unibi_get_str(ut, unibi_key_sprint) == NULL, "key_sprint = null");
++ ok(unibi_get_str(ut, unibi_key_sredo) == NULL, "key_sredo = null");
++ ok(unibi_get_str(ut, unibi_key_sreplace) == NULL, "key_sreplace = null");
++ ok(unibi_get_str(ut, unibi_key_sright) == NULL, "key_sright = null");
++ ok(unibi_get_str(ut, unibi_key_srsume) == NULL, "key_srsume = null");
++ ok(unibi_get_str(ut, unibi_key_ssave) == NULL, "key_ssave = null");
++ ok(unibi_get_str(ut, unibi_key_ssuspend) == NULL, "key_ssuspend = null");
++ ok(unibi_get_str(ut, unibi_key_sundo) == NULL, "key_sundo = null");
++ ok(unibi_get_str(ut, unibi_req_for_input) == NULL, "req_for_input = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f11), "\033[23~") == 0, "key_f11 = \"%s\"", "\\033[23~");
++ unibi_set_str(dt, unibi_key_f11, "\033[23~");
++ ok(strcmp(unibi_get_str(ut, unibi_key_f12), "\033[24~") == 0, "key_f12 = \"%s\"", "\\033[24~");
++ unibi_set_str(dt, unibi_key_f12, "\033[24~");
++ ok(unibi_get_str(ut, unibi_key_f13) == NULL, "key_f13 = null");
++ ok(unibi_get_str(ut, unibi_key_f14) == NULL, "key_f14 = null");
++ ok(unibi_get_str(ut, unibi_key_f15) == NULL, "key_f15 = null");
++ ok(unibi_get_str(ut, unibi_key_f16) == NULL, "key_f16 = null");
++ ok(unibi_get_str(ut, unibi_key_f17) == NULL, "key_f17 = null");
++ ok(unibi_get_str(ut, unibi_key_f18) == NULL, "key_f18 = null");
++ ok(unibi_get_str(ut, unibi_key_f19) == NULL, "key_f19 = null");
++ ok(unibi_get_str(ut, unibi_key_f20) == NULL, "key_f20 = null");
++ ok(unibi_get_str(ut, unibi_key_f21) == NULL, "key_f21 = null");
++ ok(unibi_get_str(ut, unibi_key_f22) == NULL, "key_f22 = null");
++ ok(unibi_get_str(ut, unibi_key_f23) == NULL, "key_f23 = null");
++ ok(unibi_get_str(ut, unibi_key_f24) == NULL, "key_f24 = null");
++ ok(unibi_get_str(ut, unibi_key_f25) == NULL, "key_f25 = null");
++ ok(unibi_get_str(ut, unibi_key_f26) == NULL, "key_f26 = null");
++ ok(unibi_get_str(ut, unibi_key_f27) == NULL, "key_f27 = null");
++ ok(unibi_get_str(ut, unibi_key_f28) == NULL, "key_f28 = null");
++ ok(unibi_get_str(ut, unibi_key_f29) == NULL, "key_f29 = null");
++ ok(unibi_get_str(ut, unibi_key_f30) == NULL, "key_f30 = null");
++ ok(unibi_get_str(ut, unibi_key_f31) == NULL, "key_f31 = null");
++ ok(unibi_get_str(ut, unibi_key_f32) == NULL, "key_f32 = null");
++ ok(unibi_get_str(ut, unibi_key_f33) == NULL, "key_f33 = null");
++ ok(unibi_get_str(ut, unibi_key_f34) == NULL, "key_f34 = null");
++ ok(unibi_get_str(ut, unibi_key_f35) == NULL, "key_f35 = null");
++ ok(unibi_get_str(ut, unibi_key_f36) == NULL, "key_f36 = null");
++ ok(unibi_get_str(ut, unibi_key_f37) == NULL, "key_f37 = null");
++ ok(unibi_get_str(ut, unibi_key_f38) == NULL, "key_f38 = null");
++ ok(unibi_get_str(ut, unibi_key_f39) == NULL, "key_f39 = null");
++ ok(unibi_get_str(ut, unibi_key_f40) == NULL, "key_f40 = null");
++ ok(unibi_get_str(ut, unibi_key_f41) == NULL, "key_f41 = null");
++ ok(unibi_get_str(ut, unibi_key_f42) == NULL, "key_f42 = null");
++ ok(unibi_get_str(ut, unibi_key_f43) == NULL, "key_f43 = null");
++ ok(unibi_get_str(ut, unibi_key_f44) == NULL, "key_f44 = null");
++ ok(unibi_get_str(ut, unibi_key_f45) == NULL, "key_f45 = null");
++ ok(unibi_get_str(ut, unibi_key_f46) == NULL, "key_f46 = null");
++ ok(unibi_get_str(ut, unibi_key_f47) == NULL, "key_f47 = null");
++ ok(unibi_get_str(ut, unibi_key_f48) == NULL, "key_f48 = null");
++ ok(unibi_get_str(ut, unibi_key_f49) == NULL, "key_f49 = null");
++ ok(unibi_get_str(ut, unibi_key_f50) == NULL, "key_f50 = null");
++ ok(unibi_get_str(ut, unibi_key_f51) == NULL, "key_f51 = null");
++ ok(unibi_get_str(ut, unibi_key_f52) == NULL, "key_f52 = null");
++ ok(unibi_get_str(ut, unibi_key_f53) == NULL, "key_f53 = null");
++ ok(unibi_get_str(ut, unibi_key_f54) == NULL, "key_f54 = null");
++ ok(unibi_get_str(ut, unibi_key_f55) == NULL, "key_f55 = null");
++ ok(unibi_get_str(ut, unibi_key_f56) == NULL, "key_f56 = null");
++ ok(unibi_get_str(ut, unibi_key_f57) == NULL, "key_f57 = null");
++ ok(unibi_get_str(ut, unibi_key_f58) == NULL, "key_f58 = null");
++ ok(unibi_get_str(ut, unibi_key_f59) == NULL, "key_f59 = null");
++ ok(unibi_get_str(ut, unibi_key_f60) == NULL, "key_f60 = null");
++ ok(unibi_get_str(ut, unibi_key_f61) == NULL, "key_f61 = null");
++ ok(unibi_get_str(ut, unibi_key_f62) == NULL, "key_f62 = null");
++ ok(unibi_get_str(ut, unibi_key_f63) == NULL, "key_f63 = null");
++ ok(strcmp(unibi_get_str(ut, unibi_clr_bol), "\033[1K") == 0, "clr_bol = \"%s\"", "\\033[1K");
++ unibi_set_str(dt, unibi_clr_bol, "\033[1K");
++ ok(unibi_get_str(ut, unibi_clear_margins) == NULL, "clear_margins = null");
++ ok(unibi_get_str(ut, unibi_set_left_margin) == NULL, "set_left_margin = null");
++ ok(unibi_get_str(ut, unibi_set_right_margin) == NULL, "set_right_margin = null");
++ ok(unibi_get_str(ut, unibi_label_format) == NULL, "label_format = null");
++ ok(unibi_get_str(ut, unibi_set_clock) == NULL, "set_clock = null");
++ ok(unibi_get_str(ut, unibi_display_clock) == NULL, "display_clock = null");
++ ok(unibi_get_str(ut, unibi_remove_clock) == NULL, "remove_clock = null");
++ ok(unibi_get_str(ut, unibi_create_window) == NULL, "create_window = null");
++ ok(unibi_get_str(ut, unibi_goto_window) == NULL, "goto_window = null");
++ ok(unibi_get_str(ut, unibi_hangup) == NULL, "hangup = null");
++ ok(unibi_get_str(ut, unibi_dial_phone) == NULL, "dial_phone = null");
++ ok(unibi_get_str(ut, unibi_quick_dial) == NULL, "quick_dial = null");
++ ok(unibi_get_str(ut, unibi_tone) == NULL, "tone = null");
++ ok(unibi_get_str(ut, unibi_pulse) == NULL, "pulse = null");
++ ok(unibi_get_str(ut, unibi_flash_hook) == NULL, "flash_hook = null");
++ ok(unibi_get_str(ut, unibi_fixed_pause) == NULL, "fixed_pause = null");
++ ok(unibi_get_str(ut, unibi_wait_tone) == NULL, "wait_tone = null");
++ ok(unibi_get_str(ut, unibi_user0) == NULL, "user0 = null");
++ ok(unibi_get_str(ut, unibi_user1) == NULL, "user1 = null");
++ ok(unibi_get_str(ut, unibi_user2) == NULL, "user2 = null");
++ ok(unibi_get_str(ut, unibi_user3) == NULL, "user3 = null");
++ ok(unibi_get_str(ut, unibi_user4) == NULL, "user4 = null");
++ ok(unibi_get_str(ut, unibi_user5) == NULL, "user5 = null");
++ ok(unibi_get_str(ut, unibi_user6) == NULL, "user6 = null");
++ ok(unibi_get_str(ut, unibi_user7) == NULL, "user7 = null");
++ ok(unibi_get_str(ut, unibi_user8) == NULL, "user8 = null");
++ ok(unibi_get_str(ut, unibi_user9) == NULL, "user9 = null");
++ ok(strcmp(unibi_get_str(ut, unibi_orig_pair), "\033[39;49m") == 0, "orig_pair = \"%s\"", "\\033[39;49m");
++ unibi_set_str(dt, unibi_orig_pair, "\033[39;49m");
++ ok(unibi_get_str(ut, unibi_orig_colors) == NULL, "orig_colors = null");
++ ok(unibi_get_str(ut, unibi_initialize_color) == NULL, "initialize_color = null");
++ ok(unibi_get_str(ut, unibi_initialize_pair) == NULL, "initialize_pair = null");
++ ok(unibi_get_str(ut, unibi_set_color_pair) == NULL, "set_color_pair = null");
++ ok(unibi_get_str(ut, unibi_set_foreground) == NULL, "set_foreground = null");
++ ok(unibi_get_str(ut, unibi_set_background) == NULL, "set_background = null");
++ ok(unibi_get_str(ut, unibi_change_char_pitch) == NULL, "change_char_pitch = null");
++ ok(unibi_get_str(ut, unibi_change_line_pitch) == NULL, "change_line_pitch = null");
++ ok(unibi_get_str(ut, unibi_change_res_horz) == NULL, "change_res_horz = null");
++ ok(unibi_get_str(ut, unibi_change_res_vert) == NULL, "change_res_vert = null");
++ ok(unibi_get_str(ut, unibi_define_char) == NULL, "define_char = null");
++ ok(unibi_get_str(ut, unibi_enter_doublewide_mode) == NULL, "enter_doublewide_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_draft_quality) == NULL, "enter_draft_quality = null");
++ ok(unibi_get_str(ut, unibi_enter_italics_mode) == NULL, "enter_italics_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_leftward_mode) == NULL, "enter_leftward_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_micro_mode) == NULL, "enter_micro_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_near_letter_quality) == NULL, "enter_near_letter_quality = null");
++ ok(unibi_get_str(ut, unibi_enter_normal_quality) == NULL, "enter_normal_quality = null");
++ ok(unibi_get_str(ut, unibi_enter_shadow_mode) == NULL, "enter_shadow_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_subscript_mode) == NULL, "enter_subscript_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_superscript_mode) == NULL, "enter_superscript_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_upward_mode) == NULL, "enter_upward_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_doublewide_mode) == NULL, "exit_doublewide_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_italics_mode) == NULL, "exit_italics_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_leftward_mode) == NULL, "exit_leftward_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_micro_mode) == NULL, "exit_micro_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_shadow_mode) == NULL, "exit_shadow_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_subscript_mode) == NULL, "exit_subscript_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_superscript_mode) == NULL, "exit_superscript_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_upward_mode) == NULL, "exit_upward_mode = null");
++ ok(unibi_get_str(ut, unibi_micro_column_address) == NULL, "micro_column_address = null");
++ ok(unibi_get_str(ut, unibi_micro_down) == NULL, "micro_down = null");
++ ok(unibi_get_str(ut, unibi_micro_left) == NULL, "micro_left = null");
++ ok(unibi_get_str(ut, unibi_micro_right) == NULL, "micro_right = null");
++ ok(unibi_get_str(ut, unibi_micro_row_address) == NULL, "micro_row_address = null");
++ ok(unibi_get_str(ut, unibi_micro_up) == NULL, "micro_up = null");
++ ok(unibi_get_str(ut, unibi_order_of_pins) == NULL, "order_of_pins = null");
++ ok(unibi_get_str(ut, unibi_parm_down_micro) == NULL, "parm_down_micro = null");
++ ok(unibi_get_str(ut, unibi_parm_left_micro) == NULL, "parm_left_micro = null");
++ ok(unibi_get_str(ut, unibi_parm_right_micro) == NULL, "parm_right_micro = null");
++ ok(unibi_get_str(ut, unibi_parm_up_micro) == NULL, "parm_up_micro = null");
++ ok(unibi_get_str(ut, unibi_select_char_set) == NULL, "select_char_set = null");
++ ok(unibi_get_str(ut, unibi_set_bottom_margin) == NULL, "set_bottom_margin = null");
++ ok(unibi_get_str(ut, unibi_set_bottom_margin_parm) == NULL, "set_bottom_margin_parm = null");
++ ok(unibi_get_str(ut, unibi_set_left_margin_parm) == NULL, "set_left_margin_parm = null");
++ ok(unibi_get_str(ut, unibi_set_right_margin_parm) == NULL, "set_right_margin_parm = null");
++ ok(unibi_get_str(ut, unibi_set_top_margin) == NULL, "set_top_margin = null");
++ ok(unibi_get_str(ut, unibi_set_top_margin_parm) == NULL, "set_top_margin_parm = null");
++ ok(unibi_get_str(ut, unibi_start_bit_image) == NULL, "start_bit_image = null");
++ ok(unibi_get_str(ut, unibi_start_char_set_def) == NULL, "start_char_set_def = null");
++ ok(unibi_get_str(ut, unibi_stop_bit_image) == NULL, "stop_bit_image = null");
++ ok(unibi_get_str(ut, unibi_stop_char_set_def) == NULL, "stop_char_set_def = null");
++ ok(unibi_get_str(ut, unibi_subscript_characters) == NULL, "subscript_characters = null");
++ ok(unibi_get_str(ut, unibi_superscript_characters) == NULL, "superscript_characters = null");
++ ok(unibi_get_str(ut, unibi_these_cause_cr) == NULL, "these_cause_cr = null");
++ ok(unibi_get_str(ut, unibi_zero_motion) == NULL, "zero_motion = null");
++ ok(unibi_get_str(ut, unibi_char_set_names) == NULL, "char_set_names = null");
++ ok(strcmp(unibi_get_str(ut, unibi_key_mouse), "\033[M") == 0, "key_mouse = \"%s\"", "\\033[M");
++ unibi_set_str(dt, unibi_key_mouse, "\033[M");
++ ok(unibi_get_str(ut, unibi_mouse_info) == NULL, "mouse_info = null");
++ ok(unibi_get_str(ut, unibi_req_mouse_pos) == NULL, "req_mouse_pos = null");
++ ok(unibi_get_str(ut, unibi_get_mouse) == NULL, "get_mouse = null");
++ ok(strcmp(unibi_get_str(ut, unibi_set_a_foreground), "\033[3%p1%dm") == 0, "set_a_foreground = \"%s\"", "\\033[3%p1%dm");
++ unibi_set_str(dt, unibi_set_a_foreground, "\033[3%p1%dm");
++ ok(strcmp(unibi_get_str(ut, unibi_set_a_background), "\033[4%p1%dm") == 0, "set_a_background = \"%s\"", "\\033[4%p1%dm");
++ unibi_set_str(dt, unibi_set_a_background, "\033[4%p1%dm");
++ ok(unibi_get_str(ut, unibi_pkey_plab) == NULL, "pkey_plab = null");
++ ok(unibi_get_str(ut, unibi_device_type) == NULL, "device_type = null");
++ ok(unibi_get_str(ut, unibi_code_set_init) == NULL, "code_set_init = null");
++ ok(unibi_get_str(ut, unibi_set0_des_seq) == NULL, "set0_des_seq = null");
++ ok(unibi_get_str(ut, unibi_set1_des_seq) == NULL, "set1_des_seq = null");
++ ok(unibi_get_str(ut, unibi_set2_des_seq) == NULL, "set2_des_seq = null");
++ ok(unibi_get_str(ut, unibi_set3_des_seq) == NULL, "set3_des_seq = null");
++ ok(unibi_get_str(ut, unibi_set_lr_margin) == NULL, "set_lr_margin = null");
++ ok(unibi_get_str(ut, unibi_set_tb_margin) == NULL, "set_tb_margin = null");
++ ok(unibi_get_str(ut, unibi_bit_image_repeat) == NULL, "bit_image_repeat = null");
++ ok(unibi_get_str(ut, unibi_bit_image_newline) == NULL, "bit_image_newline = null");
++ ok(unibi_get_str(ut, unibi_bit_image_carriage_return) == NULL, "bit_image_carriage_return = null");
++ ok(unibi_get_str(ut, unibi_color_names) == NULL, "color_names = null");
++ ok(unibi_get_str(ut, unibi_define_bit_image_region) == NULL, "define_bit_image_region = null");
++ ok(unibi_get_str(ut, unibi_end_bit_image_region) == NULL, "end_bit_image_region = null");
++ ok(unibi_get_str(ut, unibi_set_color_band) == NULL, "set_color_band = null");
++ ok(unibi_get_str(ut, unibi_set_page_length) == NULL, "set_page_length = null");
++ ok(unibi_get_str(ut, unibi_display_pc_char) == NULL, "display_pc_char = null");
++ ok(unibi_get_str(ut, unibi_enter_pc_charset_mode) == NULL, "enter_pc_charset_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_pc_charset_mode) == NULL, "exit_pc_charset_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_scancode_mode) == NULL, "enter_scancode_mode = null");
++ ok(unibi_get_str(ut, unibi_exit_scancode_mode) == NULL, "exit_scancode_mode = null");
++ ok(unibi_get_str(ut, unibi_pc_term_options) == NULL, "pc_term_options = null");
++ ok(unibi_get_str(ut, unibi_scancode_escape) == NULL, "scancode_escape = null");
++ ok(unibi_get_str(ut, unibi_alt_scancode_esc) == NULL, "alt_scancode_esc = null");
++ ok(unibi_get_str(ut, unibi_enter_horizontal_hl_mode) == NULL, "enter_horizontal_hl_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_left_hl_mode) == NULL, "enter_left_hl_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_low_hl_mode) == NULL, "enter_low_hl_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_right_hl_mode) == NULL, "enter_right_hl_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_top_hl_mode) == NULL, "enter_top_hl_mode = null");
++ ok(unibi_get_str(ut, unibi_enter_vertical_hl_mode) == NULL, "enter_vertical_hl_mode = null");
++ ok(unibi_get_str(ut, unibi_set_a_attributes) == NULL, "set_a_attributes = null");
++ ok(unibi_get_str(ut, unibi_set_pglen_inch) == NULL, "set_pglen_inch = null");
++ ok(unibi_get_str(ut, unibi_termcap_init2) == NULL, "termcap_init2 = null");
++ ok(unibi_get_str(ut, unibi_termcap_reset) == NULL, "termcap_reset = null");
++ ok(unibi_get_str(ut, unibi_linefeed_if_not_lf) == NULL, "linefeed_if_not_lf = null");
++ ok(unibi_get_str(ut, unibi_backspace_if_not_bs) == NULL, "backspace_if_not_bs = null");
++ ok(unibi_get_str(ut, unibi_other_non_function_keys) == NULL, "other_non_function_keys = null");
++ ok(unibi_get_str(ut, unibi_arrow_key_map) == NULL, "arrow_key_map = null");
++ ok(unibi_get_str(ut, unibi_acs_ulcorner) == NULL, "acs_ulcorner = null");
++ ok(unibi_get_str(ut, unibi_acs_llcorner) == NULL, "acs_llcorner = null");
++ ok(unibi_get_str(ut, unibi_acs_urcorner) == NULL, "acs_urcorner = null");
++ ok(unibi_get_str(ut, unibi_acs_lrcorner) == NULL, "acs_lrcorner = null");
++ ok(unibi_get_str(ut, unibi_acs_ltee) == NULL, "acs_ltee = null");
++ ok(unibi_get_str(ut, unibi_acs_rtee) == NULL, "acs_rtee = null");
++ ok(unibi_get_str(ut, unibi_acs_btee) == NULL, "acs_btee = null");
++ ok(unibi_get_str(ut, unibi_acs_ttee) == NULL, "acs_ttee = null");
++ ok(unibi_get_str(ut, unibi_acs_hline) == NULL, "acs_hline = null");
++ ok(unibi_get_str(ut, unibi_acs_vline) == NULL, "acs_vline = null");
++ ok(unibi_get_str(ut, unibi_acs_plus) == NULL, "acs_plus = null");
++ ok(unibi_get_str(ut, unibi_memory_lock) == NULL, "memory_lock = null");
++ ok(unibi_get_str(ut, unibi_memory_unlock) == NULL, "memory_unlock = null");
++ ok(unibi_get_str(ut, unibi_box_chars_1) == NULL, "box_chars_1 = null");
++
++ note("extended boolean capabilities");
++ {
++ const size_t n_ext = unibi_count_ext_bool(ut);
++ ok(n_ext == 3, "#ext_bool = 3");
++ ok(0 < n_ext && unibi_get_ext_bool(ut, 0) == 1, "ext_bool[0].value = 1");
++ ok(0 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 0), "AX") == 0, "ext_bool[0].name = \"%s\"", "AX");
++ unibi_add_ext_bool(dt, "AX", 1);
++ ok(1 < n_ext && unibi_get_ext_bool(ut, 1) == 1, "ext_bool[1].value = 1");
++ ok(1 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 1), "G0") == 0, "ext_bool[1].name = \"%s\"", "G0");
++ unibi_add_ext_bool(dt, "G0", 1);
++ ok(2 < n_ext && unibi_get_ext_bool(ut, 2) == 0, "ext_bool[2].value = 0");
++ ok(2 < n_ext && strcmp(unibi_get_ext_bool_name(ut, 2), "XT") == 0, "ext_bool[2].name = \"%s\"", "XT");
++ unibi_add_ext_bool(dt, "XT", 0);
++ }
++
++ note("extended numeric capabilities");
++ {
++ const size_t n_ext = unibi_count_ext_num(ut);
++ ok(n_ext == 1, "#ext_num = 1");
++ ok(0 < n_ext && unibi_get_ext_num(ut, 0) == 1, "ext_num[0].value = 1");
++ ok(0 < n_ext && strcmp(unibi_get_ext_num_name(ut, 0), "U8") == 0, "ext_num[0].name = \"%s\"", "U8");
++ unibi_add_ext_num(dt, "U8", 1);
++ }
++
++ note("extended string capabilities");
++ {
++ const size_t n_ext = unibi_count_ext_str(ut);
++ ok(n_ext == 12, "#ext_str = 12");
++ ok(0 < n_ext && strcmp(unibi_get_ext_str(ut, 0), "\033(B") == 0, "ext_str[0].value = \"%s\"", "\\033(B");
++ unibi_add_ext_str(dt, "E0", "\033(B");
++ ok(0 < n_ext && strcmp(unibi_get_ext_str_name(ut, 0), "E0") == 0, "ext_str[0].name = \"%s\"", "E0");
++ ok(1 < n_ext && unibi_get_ext_str(ut, 1) == NULL, "ext_str[1].value = null");
++ unibi_add_ext_str(dt, "E3", NULL);
++ ok(1 < n_ext && strcmp(unibi_get_ext_str_name(ut, 1), "E3") == 0, "ext_str[1].name = \"%s\"", "E3");
++ ok(2 < n_ext && strcmp(unibi_get_ext_str(ut, 2), "\033(%p1%c") == 0, "ext_str[2].value = \"%s\"", "\\033(%p1%c");
++ unibi_add_ext_str(dt, "S0", "\033(%p1%c");
++ ok(2 < n_ext && strcmp(unibi_get_ext_str_name(ut, 2), "S0") == 0, "ext_str[2].name = \"%s\"", "S0");
++ ok(3 < n_ext && unibi_get_ext_str(ut, 3) == NULL, "ext_str[3].value = null");
++ unibi_add_ext_str(dt, "TS", NULL);
++ ok(3 < n_ext && strcmp(unibi_get_ext_str_name(ut, 3), "TS") == 0, "ext_str[3].name = \"%s\"", "TS");
++ ok(4 < n_ext && unibi_get_ext_str(ut, 4) == NULL, "ext_str[4].value = null");
++ unibi_add_ext_str(dt, "XM", NULL);
++ ok(4 < n_ext && strcmp(unibi_get_ext_str_name(ut, 4), "XM") == 0, "ext_str[4].name = \"%s\"", "XM");
++ ok(5 < n_ext && unibi_get_ext_str(ut, 5) == NULL, "ext_str[5].value = null");
++ unibi_add_ext_str(dt, "kEND5", NULL);
++ ok(5 < n_ext && strcmp(unibi_get_ext_str_name(ut, 5), "kEND5") == 0, "ext_str[5].name = \"%s\"", "kEND5");
++ ok(6 < n_ext && unibi_get_ext_str(ut, 6) == NULL, "ext_str[6].value = null");
++ unibi_add_ext_str(dt, "kHOM5", NULL);
++ ok(6 < n_ext && strcmp(unibi_get_ext_str_name(ut, 6), "kHOM5") == 0, "ext_str[6].name = \"%s\"", "kHOM5");
++ ok(7 < n_ext && unibi_get_ext_str(ut, 7) == NULL, "ext_str[7].value = null");
++ unibi_add_ext_str(dt, "ka2", NULL);
++ ok(7 < n_ext && strcmp(unibi_get_ext_str_name(ut, 7), "ka2") == 0, "ext_str[7].name = \"%s\"", "ka2");
++ ok(8 < n_ext && unibi_get_ext_str(ut, 8) == NULL, "ext_str[8].value = null");
++ unibi_add_ext_str(dt, "kb1", NULL);
++ ok(8 < n_ext && strcmp(unibi_get_ext_str_name(ut, 8), "kb1") == 0, "ext_str[8].name = \"%s\"", "kb1");
++ ok(9 < n_ext && unibi_get_ext_str(ut, 9) == NULL, "ext_str[9].value = null");
++ unibi_add_ext_str(dt, "kb3", NULL);
++ ok(9 < n_ext && strcmp(unibi_get_ext_str_name(ut, 9), "kb3") == 0, "ext_str[9].name = \"%s\"", "kb3");
++ ok(10 < n_ext && unibi_get_ext_str(ut, 10) == NULL, "ext_str[10].value = null");
++ unibi_add_ext_str(dt, "kc2", NULL);
++ ok(10 < n_ext && strcmp(unibi_get_ext_str_name(ut, 10), "kc2") == 0, "ext_str[10].name = \"%s\"", "kc2");
++ ok(11 < n_ext && unibi_get_ext_str(ut, 11) == NULL, "ext_str[11].value = null");
++ unibi_add_ext_str(dt, "xm", NULL);
++ ok(11 < n_ext && strcmp(unibi_get_ext_str_name(ut, 11), "xm") == 0, "ext_str[11].name = \"%s\"", "xm");
++ }
++
++ {
++ char buf[sizeof terminfo];
++ size_t r = unibi_dump(ut, buf, sizeof buf);
++ ok(r == sizeof terminfo, "redump size == orig size");
++ ok(memcmp(terminfo, buf, sizeof buf) == 0, "redump == orig");
++ }
++
++ {
++ char buf[sizeof terminfo];
++ size_t r = unibi_dump(dt, buf, sizeof buf);
++ ok(r == sizeof terminfo, "dummy redump size == orig size");
++ ok(memcmp(terminfo, buf, sizeof buf) == 0, "dummy redump == orig");
++ }
++
++ unibi_destroy(ut);
++ ok(1, "object destroyed");
++
++ unibi_destroy(dt);
++ ok(1, "dummy object destroyed");
++
++ return 0;
++}
++
++static void setup(void) {
++ plan(543);
++}
+diff --git a/unibilium.c b/unibilium.c
+index 64472de..8586b6f 100644
+--- a/unibilium.c
++++ b/unibilium.c
+@@ -339,8 +339,6 @@ unibi_term *unibi_from_mem(const char *p, size_t n) {
+ extalllen += extnumlen;
+ extalllen += extstrslen;
+
+- DEL_FAIL_IF(extofflen != extalllen + extstrslen, EINVAL, t);
+-
+ DEL_FAIL_IF(
+ n <
+ extboollen +
+--
+2.19.1
+