---
+test/prompt.ha | 10 ++++++++--
+test/term.ha | 13 +++++++++----
2 files changed, 17 insertions(+), 6 deletions(-)
diff --git a/+test/prompt.ha b/+test/prompt.ha
index 4088436..ce01a04 100644
--- a/+test/prompt.ha
+++ b/+test/prompt.ha
@@ -12,7 +12,10 @@ use fmt;
let pe = env::getenv();
pe.pd = "t:one.one|f:|t:one.two|l:|t:two.one|f:|t:two.two|l:|t:three.one|f:|t:three.two";
pe.columns = 40;
- pe.control = env::getctrl(['f', 't', 'f', 't', 'f', 'f', 'z']);
+ pe.control = match(env::getctrl(['f', 't', 'f', 't', 'f', 'f', 'z'])) {
+ case let c: *env::control => yield c;
+ case env::error => fmt::fatal("Control line error");
+ };
const pr = prompt::prompt(pe);
const ex = "one.one one.two\\ntwo.one two.two\\nthree.one three.two";
assert(pr == ex, "Prompt mismatch - fills and newlines");
@@ -22,7 +25,10 @@ use fmt;
let pe = env::getenv();
pe.pd = "t:one.one|f:|t:one.two|l:|t:two.one|f:|t:two.two|l:|t:three.one|f:|t:three.two";
pe.columns = 40;
- pe.control = env::getctrl(['f', 't', 'f', 't', 'f', 'f', 'b']);
+ pe.control = match(env::getctrl(['f', 't', 'f', 't', 'f', 'f', 'b'])) {
+ case let c: *env::control => yield c;
+ case env::error => fmt::fatal("Control line error");
+ };
const pr = prompt::prompt(pe);
const ex = "one.one one.two\\ntwo.one two.two\\nthree.one three.two";
assert(pr == ex, "Prompt mismatch - fills and newlines");
diff --git a/+test/term.ha b/+test/term.ha
index ffd305d..a27dbf9 100644
--- a/+test/term.ha
+++ b/+test/term.ha
@@ -3,6 +3,7 @@
//
// SPDX-FileCopyrightText: 2022 Tom Regner <tomte@tomsdiner.org>
// SPDX-License-Identifier: GPL-3.0-or-later
+use fmt;
use strings;
use term::*;
@@ -18,8 +19,10 @@ use env;
@test fn term_strlen_zsh() void = {
const pe: *env::env = env::getenv();
// not remote, last status ok, don't reload conf, no timer, not root, set title,zsh
- pe.control = env::getctrl(['f', 't', 'f', 'f', 'f', 't', 'z']);
-
+ pe.control = match(env::getctrl(['f', 't', 'f', 'f', 'f', 't', 'z'])) {
+ case let c: *env::control => yield c;
+ case env::error => fmt::fatal("Control line error");
+ };
// check that ansic wraps aren't counted towards the string length
const txt = strings::concat(wrapc(fg_blue, pe), "fuenf", wrapc(reset, pe), wrapc(blink,pe), "sechse", wrapc(reset,pe));
defer free(txt);
@@ -44,8 +47,10 @@ use env;
@test fn term_strlen_bash() void = {
const pe: *env::env = env::getenv();
// not remote, last status ok, don't reload conf, no timer, not root, set title, bash
- pe.control = env::getctrl(['f', 't', 'f', 'f', 'f', 't', 'b']);
-
+ pe.control = match(env::getctrl(['f', 't', 'f', 'f', 'f', 't', 'b'])) {
+ case let c: *env::control => yield c;
+ case env::error => fmt::fatal("Control line error");
+ };
// check that ansic wraps aren't counted towards the string length
const expected = 11z;
const txt = strings::concat(wrapc(fg_blue, pe), "fuenf", wrapc(reset, pe), wrapc(blink,pe), "sechse", wrapc(reset,pe));
--
2.30.2