aboutsummaryrefslogtreecommitdiff
path: root/ttt.jai
diff options
context:
space:
mode:
Diffstat (limited to 'ttt.jai')
-rw-r--r--ttt.jai42
1 files changed, 21 insertions, 21 deletions
diff --git a/ttt.jai b/ttt.jai
index 8f39b56..45dc7f8 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -866,7 +866,7 @@ initialize_tui :: () {
}
}
- TUI.start();
+ assert(TUI.start(), "Failed to start TUI.");
}
update_layout :: () {
@@ -1165,7 +1165,7 @@ main :: () {
print("- success\n", to_standard_error = true);
}
else {
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
print("- ERROR: %", error_message, to_standard_error = true);
exit(1);
}
@@ -1178,19 +1178,19 @@ main :: () {
if perform_test && 1 {
print("TEST : set and get cursor position\n", to_standard_error = true);
- TUI.start();
+ assert(TUI.start(), "Failed to start TUI.");
X :: 2;
Y :: 3;
TUI.set_cursor_position(X, Y);
x, y := TUI.get_cursor_position();
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
assert_result(x == X && y == Y, "Failed set/get cursor position.\n");
}
if perform_test && 1 {
print("TEST : module logger\n", to_standard_error = true);
log("- log: before module start.");
- TUI.start();
+ assert(TUI.start(), "Failed to start TUI.");
TUI.set_cursor_position(3, 3);
print("wait");
sleep_milliseconds(1000);
@@ -1198,14 +1198,14 @@ main :: () {
sleep_milliseconds(1000);
print(" a bit");
sleep_milliseconds(1000);
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
log("- log: after module stop.");
}
if perform_test && 1 {
print("TEST : test key input\n", to_standard_error = true);
auto_release_temp();
- TUI.start();
+ assert(TUI.start(), "Failed to start TUI.");
TUI.clear_terminal();
TUI.set_cursor_position(1, 1);
write_string("Press q to exit, other key to print it to screen, wait 1s to see animation.");
@@ -1224,28 +1224,28 @@ main :: () {
write_string(TUI.to_string(key));
}
}
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
print("- success\n", to_standard_error = true);
}
if perform_test && 1 {
print("TEST : draw box\n", to_standard_error = true);
auto_release_temp();
- TUI.start();
+ assert(TUI.start(), "Failed to start TUI.");
TUI.flush_input();
TUI.clear_terminal();
TUI.draw_box(1, 2, 5, 3);
TUI.set_cursor_position(1, 1);
print("Can you see the box below? (y/n)");
key := TUI.get_key();
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
assert_result(key == #char "y", "Failed to draw box.\n");
}
if perform_test && 1 {
print("TEST : get terminal size\n", to_standard_error = true);
auto_release_temp();
- TUI.start();
+ assert(TUI.start(), "Failed to start TUI.");
TUI.clear_terminal();
width, height := TUI.get_terminal_size();
TUI.set_cursor_position(1, 1);
@@ -1254,13 +1254,13 @@ main :: () {
while (key == xx TUI.Keys.None || key == xx TUI.Keys.Resize) {
key = TUI.get_key();
}
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
assert_result(key == #char "y", "Failed to get terminal size.\n");
}
if perform_test && 1 {
print("TEST : set terminal title\n", to_standard_error = true);
- TUI.start();
+ assert(TUI.start(), "Failed to start TUI.");
title := "BAZINGA";
TUI.set_terminal_title(title);
TUI.set_cursor_position(1, 1);
@@ -1269,14 +1269,14 @@ main :: () {
while (key == xx TUI.Keys.None || key == xx TUI.Keys.Resize) {
key = TUI.get_key();
}
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
assert_result(key == #char "y", "Failed to set terminal title.\n");
}
if perform_test && 1 {
print("TEST : print keys and set terminal title\n", to_standard_error = true);
auto_release_temp();
- TUI.start();
+ assert(TUI.start(), "Failed to start TUI.");
TUI.set_terminal_title("bazinga");
key: TUI.Key = #char "d";
last_none_char := "X";
@@ -1335,13 +1335,13 @@ main :: () {
// set_temporary_storage_mark(__mark);
}
print("- success");
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
}
if perform_test && 1 {
print("TEST : user input\n", to_standard_error = true);
auto_release_temp();
- TUI.start();
+ assert(TUI.start(), "Failed to start TUI.");
TUI.clear_terminal();
TUI.set_cursor_position(1, 1);
print("Enter some text (use Enter to finish, Esc to cancel, or resize to abort):");
@@ -1366,14 +1366,14 @@ main :: () {
}
}
answer := TUI.get_key();
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
assert_result(answer == #char "y", error_message);
}
if perform_test && 1 {
print("TEST : hidden user input\n", to_standard_error = true);
auto_release_temp();
- TUI.start();
+ assert(TUI.start(), "Failed to start TUI.");
TUI.clear_terminal();
TUI.set_cursor_position(1, 1);
print("Enter some secret (use Enter to finish, Esc to cancel, or resize to abort):");
@@ -1397,7 +1397,7 @@ main :: () {
}
}
answer := TUI.get_key();
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
assert_result(answer == #char "y", error_message);
}
@@ -2018,7 +2018,7 @@ main :: () {
TUI.get_key();
}
- TUI.stop();
+ assert(TUI.stop(), "Failed to stop TUI.");
exit(xx ifx error_saving then 1 else 0);
}