From e6cbb01b5539ee9a099714b5372ea8bfd0d3bc7d Mon Sep 17 00:00:00 2001 From: Jonathan de Boyne Pollard Date: Sat, 27 May 2017 18:11:35 +0100 Subject: tui: Update colour tests. --- test/functional/terminal/tui_spec.lua | 142 +++++++++++++++++++++++++++++----- 1 file changed, 123 insertions(+), 19 deletions(-) (limited to 'test/functional/terminal') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 3ed63f68e9..b3aaa83b17 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -318,6 +318,7 @@ end) describe("tui 't_Co' (terminal colors)", function() local screen local is_linux = (helpers.eval("system('uname') =~? 'linux'") == 1) + local is_freebsd = (helpers.eval("system('uname') =~? 'FreeBSD'") == 1) local function assert_term_colors(term, colorterm, maxcolors) helpers.clear({env={TERM=term}, args={}}) @@ -332,7 +333,7 @@ describe("tui 't_Co' (terminal colors)", function() thelpers.feed_data(":echo &t_Co\n") helpers.wait() local tline - if maxcolors == 8 then + if maxcolors == 8 or maxcolors == 16 then tline = "~ " else tline = "{4:~ }" @@ -348,35 +349,71 @@ describe("tui 't_Co' (terminal colors)", function() ]], tline, tline, tline, tostring(maxcolors and maxcolors or ""))) end - it("unknown TERM sets empty 't_Co'", function() - assert_term_colors("yet-another-term", nil, nil) + -- ansi and no terminal type at all: + + it("no TERM uses 8 colors", function() + assert_term_colors(nil, nil, 8) + end) + + it("TERM=ansi no COLORTERM uses 8 colors", function() + assert_term_colors("ansi", nil, 8) + end) + + it("TERM=ansi with COLORTERM=anything-no-number uses 16 colors", function() + assert_term_colors("ansi", "yet-another-term", 16) + end) + + it("unknown TERM COLORTERM with 256 in name uses 256 colors", function() + assert_term_colors("ansi", "yet-another-term-256color", 256) + end) + + it("TERM=ansi-256color sets 256 colours", function() + assert_term_colors("ansi-256color", nil, 256) + end) + + -- Unknown terminal types: + + it("unknown TERM no COLORTERM sets 8 colours", function() + assert_term_colors("yet-another-term", nil, 8) + end) + + it("unknown TERM with COLORTERM=anything-no-number uses 16 colors", function() + assert_term_colors("yet-another-term", "yet-another-term", 16) + end) + + it("unknown TERM with 256 in name sets 256 colours", function() + assert_term_colors("yet-another-term-256color", nil, 256) end) - it("unknown TERM with COLORTERM=screen-256color uses 256 colors", function() - assert_term_colors("yet-another-term", "screen-256color", 256) + it("unknown TERM COLORTERM with 256 in name uses 256 colors", function() + assert_term_colors("yet-another-term", "yet-another-term-256color", 256) end) + -- Linux kernel terminal emulator: + it("TERM=linux uses 256 colors", function() - if is_linux then - assert_term_colors("linux", nil, 256) - else - pending() - end + assert_term_colors("linux", nil, 256) end) it("TERM=linux-16color uses 256 colors", function() - if is_linux then - assert_term_colors("linux-16color", nil, 256) + assert_term_colors("linux-16color", nil, 256) + end) + + -- screen and tmux: + + it("TERM=screen no COLORTERM uses 8/256 colors", function() + if is_freebsd then + assert_term_colors("screen", nil, 256) else - pending() + assert_term_colors("screen", nil, 8) end end) - it("TERM=screen uses 8 colors", function() - if is_linux then - assert_term_colors("screen", nil, 8) + it("TERM=screen COLORTERM=screen uses 16/256 colors", function() + if is_freebsd then + assert_term_colors("screen", "screen", 256) else - pending() + assert_term_colors("screen", "screen", 16) end end) @@ -384,15 +421,82 @@ describe("tui 't_Co' (terminal colors)", function() assert_term_colors("screen", "screen-256color", 256) end) - it("TERM=yet-another-term COLORTERM=screen-256color uses 256 colors", function() - assert_term_colors("screen", "screen-256color", 256) + it("TERM=screen-256color no COLORTERM uses 256 colors", function() + assert_term_colors("screen-256color", nil, 256) end) + it("TERM=tmux no COLORTERM uses 8/256 colors", function() + if is_freebsd then + assert_term_colors("tmux", nil, 256) + else + assert_term_colors("tmux", nil, 8) + end + end) + + it("TERM=tmux COLORTERM=tmux uses 16/256 colors", function() + if is_freebsd then + assert_term_colors("tmux", "tmux", 256) + else + assert_term_colors("tmux", "tmux", 16) + end + end) + + it("TERM=tmux COLORTERM=tmux-256color uses 256 colors", function() + assert_term_colors("tmux", "tmux-256color", 256) + end) + + it("TERM=tmux-256color no COLORTERM uses 256 colors", function() + assert_term_colors("tmux-256color", nil, 256) + end) + + -- xterm and imitators: + it("TERM=xterm uses 256 colors", function() assert_term_colors("xterm", nil, 256) end) + it("TERM=xterm COLORTERM=gnome-terminal uses 256 colors", function() + assert_term_colors("xterm", "gnome-terminal", 256) + end) + + it("TERM=xterm COLORTERM=mate-terminal uses 256 colors", function() + assert_term_colors("xterm", "mate-terminal", 256) + end) + it("TERM=xterm-256color uses 256 colors", function() assert_term_colors("xterm-256color", nil, 256) end) + + -- rxvt and stterm: + + it("TERM=rxvt no COLORTERM uses 256 colors", function() + assert_term_colors("rxvt", nil, 256) + end) + + it("TERM=rxvt-256color uses 256 colors", function() + assert_term_colors("rxvt-256color", nil, 256) + end) + + it("TERM=st no COLORTERM uses 256 colors", function() + assert_term_colors("st", nil, 256) + end) + + it("TERM=st-256color uses 256 colors", function() + assert_term_colors("st-256color", nil, 256) + end) + + -- others: + + it("TERM=interix uses 8 colors", function() + assert_term_colors("interix", nil, 8) + end) + + it("TERM=iterm uses 16/256 colors", function() + if is_freebsd then + assert_term_colors("iterm", nil, 256) + else + assert_term_colors("iterm", nil, 16) + end + end) + end) -- cgit From 8f60395dd1fdf3b6995c75475878e2d73e7482c0 Mon Sep 17 00:00:00 2001 From: Jonathan de Boyne Pollard Date: Sat, 27 May 2017 19:52:14 +0100 Subject: tui: Update colour tests some more. --- test/functional/terminal/tui_spec.lua | 42 +++++++++++++++++++---------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'test/functional/terminal') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index b3aaa83b17..ff4314c36c 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -425,20 +425,12 @@ describe("tui 't_Co' (terminal colors)", function() assert_term_colors("screen-256color", nil, 256) end) - it("TERM=tmux no COLORTERM uses 8/256 colors", function() - if is_freebsd then - assert_term_colors("tmux", nil, 256) - else - assert_term_colors("tmux", nil, 8) - end + it("TERM=tmux no COLORTERM uses 256 colors", function() + assert_term_colors("tmux", nil, 256) end) - it("TERM=tmux COLORTERM=tmux uses 16/256 colors", function() - if is_freebsd then - assert_term_colors("tmux", "tmux", 256) - else - assert_term_colors("tmux", "tmux", 16) - end + it("TERM=tmux COLORTERM=tmux uses 256 colors", function() + assert_term_colors("tmux", "tmux", 256) end) it("TERM=tmux COLORTERM=tmux-256color uses 256 colors", function() @@ -477,7 +469,23 @@ describe("tui 't_Co' (terminal colors)", function() assert_term_colors("rxvt-256color", nil, 256) end) - it("TERM=st no COLORTERM uses 256 colors", function() + it("TERM=st no COLORTERM uses 8/256 colors", function() + if is_freebsd then + assert_term_colors("st", nil, 256) + else + assert_term_colors("st", nil, 8) + end + end) + + it("TERM=st COLORTERM=st uses 16/256 colors", function() + if is_freebsd then + assert_term_colors("st", nil, 256) + else + assert_term_colors("st", nil, 16) + end + end) + + it("TERM=st COLORTERM=st-256color uses 256 colors", function() assert_term_colors("st", nil, 256) end) @@ -491,12 +499,8 @@ describe("tui 't_Co' (terminal colors)", function() assert_term_colors("interix", nil, 8) end) - it("TERM=iterm uses 16/256 colors", function() - if is_freebsd then - assert_term_colors("iterm", nil, 256) - else - assert_term_colors("iterm", nil, 16) - end + it("TERM=iterm uses 256 colors", function() + assert_term_colors("iterm", nil, 256) end) end) -- cgit From 3f8dedd7aefaa64cea83add75715701b50625812 Mon Sep 17 00:00:00 2001 From: Jonathan de Boyne Pollard Date: Sun, 28 May 2017 01:30:08 +0100 Subject: tui: Correct a copy and paste error in stterm tests. The test decsription was correct; the test was not. --- test/functional/terminal/tui_spec.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/functional/terminal') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index ff4314c36c..ac30be1e58 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -479,14 +479,14 @@ describe("tui 't_Co' (terminal colors)", function() it("TERM=st COLORTERM=st uses 16/256 colors", function() if is_freebsd then - assert_term_colors("st", nil, 256) + assert_term_colors("st", "st", 256) else - assert_term_colors("st", nil, 16) + assert_term_colors("st", "st", 16) end end) it("TERM=st COLORTERM=st-256color uses 256 colors", function() - assert_term_colors("st", nil, 256) + assert_term_colors("st", "st-256color", 256) end) it("TERM=st-256color uses 256 colors", function() -- cgit From 5377de33ac4adea54c9c9980c7a6bc8cc70c0c7a Mon Sep 17 00:00:00 2001 From: Jonathan de Boyne Pollard Date: Sun, 28 May 2017 12:18:01 +0100 Subject: tui: Add st to the always 256-colour capable list. Also comment and augment some terminal colour tests. --- test/functional/terminal/tui_spec.lua | 49 ++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 12 deletions(-) (limited to 'test/functional/terminal') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index ac30be1e58..225a1fc170 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -399,7 +399,15 @@ describe("tui 't_Co' (terminal colors)", function() assert_term_colors("linux-16color", nil, 256) end) + it("TERM=linux-256color uses 256 colors", function() + assert_term_colors("linux-256color", nil, 256) + end) + -- screen and tmux: + -- + -- FreeBSD falls back to the built-in screen-256colour entry. + -- Linux and MacOS have a screen entry in external terminfo with 8 colours, + -- which is raised to 16 by COLORTERM. it("TERM=screen no COLORTERM uses 8/256 colors", function() if is_freebsd then @@ -460,35 +468,48 @@ describe("tui 't_Co' (terminal colors)", function() end) -- rxvt and stterm: + -- + -- FreeBSD and MacOS fall back to the built-in rxvt-256color and + -- st-256colour entries. + -- Linux has an rxvt, an st, and an st-16color entry in external terminfo + -- with 8, 8, and 16 colours respectively, which are raised to 256. it("TERM=rxvt no COLORTERM uses 256 colors", function() assert_term_colors("rxvt", nil, 256) end) + it("TERM=rxvt COLORTERM=rxvt uses 256 colors", function() + assert_term_colors("rxvt", "rxvt", 256) + end) + it("TERM=rxvt-256color uses 256 colors", function() assert_term_colors("rxvt-256color", nil, 256) end) - it("TERM=st no COLORTERM uses 8/256 colors", function() - if is_freebsd then - assert_term_colors("st", nil, 256) - else - assert_term_colors("st", nil, 8) - end + it("TERM=st no COLORTERM uses 256 colors", function() + assert_term_colors("st", nil, 256) end) - it("TERM=st COLORTERM=st uses 16/256 colors", function() - if is_freebsd then - assert_term_colors("st", "st", 256) - else - assert_term_colors("st", "st", 16) - end + it("TERM=st COLORTERM=st uses 256 colors", function() + assert_term_colors("st", "st", 256) end) it("TERM=st COLORTERM=st-256color uses 256 colors", function() assert_term_colors("st", "st-256color", 256) end) + it("TERM=st-16color no COLORTERM uses 8/256 colors", function() + assert_term_colors("st", nil, 256) + end) + + it("TERM=st-16color COLORTERM=st uses 16/256 colors", function() + assert_term_colors("st", "st", 256) + end) + + it("TERM=st-16color COLORTERM=st-256color uses 256 colors", function() + assert_term_colors("st", "st-256color", 256) + end) + it("TERM=st-256color uses 256 colors", function() assert_term_colors("st-256color", nil, 256) end) @@ -499,6 +520,10 @@ describe("tui 't_Co' (terminal colors)", function() assert_term_colors("interix", nil, 8) end) + it("TERM=iTerm.app uses 256 colors", function() + assert_term_colors("iTerm.app", nil, 256) + end) + it("TERM=iterm uses 256 colors", function() assert_term_colors("iterm", nil, 256) end) -- cgit From 1c1231bf139943382df6cec9221f84708d4aea64 Mon Sep 17 00:00:00 2001 From: Jonathan de Boyne Pollard Date: Mon, 29 May 2017 07:51:06 +0100 Subject: tui: Add built-in terminfo entry for VTE. Also slightly refactor the way in which GNOME/MATE Terminal pretending to be xterm is detected. --- test/functional/terminal/tui_spec.lua | 39 +++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) (limited to 'test/functional/terminal') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index 225a1fc170..d27e93c9f9 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -514,6 +514,45 @@ describe("tui 't_Co' (terminal colors)", function() assert_term_colors("st-256color", nil, 256) end) + -- gnome and vte: + -- + -- FreeBSD and MacOS fall back to the built-in vte-256color entry. + -- Linux has a gnome, a vte, a gnome-256color, and a vte-256color entry in + -- external terminfo with 8, 8, 256, and 256 colours respectively, which are + -- raised to 256. + + it("TERM=gnome no COLORTERM uses 256 colors", function() + assert_term_colors("gnome", nil, 256) + end) + + it("TERM=gnome COLORTERM=gnome uses 256 colors", function() + assert_term_colors("gnome", "gnome", 256) + end) + + it("TERM=gnome COLORTERM=gnome-256color uses 256 colors", function() + assert_term_colors("gnome", "gnome-256color", 256) + end) + + it("TERM=gnome-256color uses 256 colors", function() + assert_term_colors("gnome-256color", nil, 256) + end) + + it("TERM=vte no COLORTERM uses 256 colors", function() + assert_term_colors("vte", nil, 256) + end) + + it("TERM=vte COLORTERM=vte uses 256 colors", function() + assert_term_colors("vte", "vte", 256) + end) + + it("TERM=vte COLORTERM=vte-256color uses 256 colors", function() + assert_term_colors("vte", "vte-256color", 256) + end) + + it("TERM=vte-256color uses 256 colors", function() + assert_term_colors("vte-256color", nil, 256) + end) + -- others: it("TERM=interix uses 8 colors", function() -- cgit From 86d796656ca84e9f672b1f899b8211c47561db5c Mon Sep 17 00:00:00 2001 From: Jonathan de Boyne Pollard Date: Sat, 3 Jun 2017 15:16:40 +0100 Subject: tui: Correct commentary on tmux colour tests. --- test/functional/terminal/tui_spec.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'test/functional/terminal') diff --git a/test/functional/terminal/tui_spec.lua b/test/functional/terminal/tui_spec.lua index d27e93c9f9..cb436dbeea 100644 --- a/test/functional/terminal/tui_spec.lua +++ b/test/functional/terminal/tui_spec.lua @@ -403,7 +403,7 @@ describe("tui 't_Co' (terminal colors)", function() assert_term_colors("linux-256color", nil, 256) end) - -- screen and tmux: + -- screen: -- -- FreeBSD falls back to the built-in screen-256colour entry. -- Linux and MacOS have a screen entry in external terminfo with 8 colours, @@ -433,6 +433,12 @@ describe("tui 't_Co' (terminal colors)", function() assert_term_colors("screen-256color", nil, 256) end) + -- tmux: + -- + -- FreeBSD and MacOS fall back to the built-in tmux-256colour entry. + -- Linux has a tmux entry in external terminfo with 8 colours, + -- which is raised to 256. + it("TERM=tmux no COLORTERM uses 256 colors", function() assert_term_colors("tmux", nil, 256) end) -- cgit