summaryrefslogtreecommitdiff
path: root/tests/dcs_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'tests/dcs_test.c')
-rw-r--r--tests/dcs_test.c53
1 files changed, 49 insertions, 4 deletions
diff --git a/tests/dcs_test.c b/tests/dcs_test.c
index 0e67f78..d9455be 100644
--- a/tests/dcs_test.c
+++ b/tests/dcs_test.c
@@ -176,8 +176,8 @@ static void test_xtgettcap(void)
{
struct term *t = new_term(80, 24);
assert_tcap(t, "kind", "\033[1;2B");
- assert_tcap(t, "TN", "wsap_term");
- assert_tcap(t, "name", "wsap_term");
+ assert_tcap(t, "TN", "term");
+ assert_tcap(t, "name", "term");
assert_tcap(t, "Co", "16777216");
assert_tcap(t, "colors", "16777216");
assert_tcap(t, "RGB", "8/8/8");
@@ -230,7 +230,7 @@ static void test_xtgettcap_multi(void)
snprintf(req, sizeof(req), "\033P+q%s;%s\033\\", hk, htn);
snprintf(want, sizeof(want), "\033P1+r%s=%s;%s=%s\033\\",
- hk, hv, htn, "777361705f7465726d");
+ hk, hv, htn, "7465726d");
response_len = 0;
write_seq(t, req);
expect_response(want);
@@ -383,7 +383,51 @@ static void test_xtversion(void)
struct term *t = new_term(80, 24);
response_len = 0;
write_seq(t, "\033[>0q");
- expect_response("\033P>|wsap_term\033\\");
+ expect_response("\033P>|term\033\\");
+ term_free(t);
+}
+
+/* term_options.name feeds XTVERSION and the TN and name capabilities. */
+static void test_host_name(void)
+{
+ struct term_options opt = {
+ .size = { .x = 80, .y = 24 },
+ .scrollback = TEST_SCROLLBACK,
+ .name = "myterm",
+ .callbacks = { .reply = respond },
+ };
+ struct term *t = term_new(&opt);
+ assert(t);
+ response_len = 0;
+ write_seq(t, "\033[>0q");
+ expect_response("\033P>|myterm\033\\");
+ assert_tcap(t, "TN", "myterm");
+ assert_tcap(t, "name", "myterm");
+
+ /* A DCS +p sets the capability value. The XTVERSION name does not change. */
+ response_len = 0;
+ write_seq(t, "\033P+p6f74686572\033\\");
+ expect_no_response();
+ assert_tcap(t, "TN", "other");
+ response_len = 0;
+ write_seq(t, "\033[>0q");
+ expect_response("\033P>|myterm\033\\");
+ term_free(t);
+
+ /* NULL and "" both select the default. */
+ opt.name = "";
+ t = term_new(&opt);
+ assert(t);
+ response_len = 0;
+ write_seq(t, "\033[>0q");
+ expect_response("\033P>|term\033\\");
+ term_free(t);
+ opt.name = NULL;
+ t = term_new(&opt);
+ assert(t);
+ response_len = 0;
+ write_seq(t, "\033[>0q");
+ expect_response("\033P>|term\033\\");
term_free(t);
}
@@ -467,6 +511,7 @@ int main(void)
test_synchronized_output();
test_ignored_dcs();
test_xtversion();
+ test_host_name();
test_bel_terminator();
test_dcs_long_query();
test_dcs_abort_c0();