summaryrefslogtreecommitdiff
path: root/tests/history_text_test.c
diff options
context:
space:
mode:
authorBerke Gรผzel <wenekar1@gmail.com>2026-10-15 13:04:01 +0300
committerBerke Gรผzel <wenekar1@gmail.com>2026-10-15 13:04:01 +0300
commitdcebf9c7f954a55350b68d0ead1935612c4e2e05 (patch)
tree3eb3e9f6154c6760bcb89a565f8ddc8f8b66cb90 /tests/history_text_test.c
parentbd8222e615134c3ec5e7a07b6b1fa97c9bd4a471 (diff)
Rename the library to wsap_vtcore
ncurses installs <term.h> and defines struct term. In a file that includes both headers, an ncurses TERMINAL * and this library's terminal are silently the same type. The name wsap_vtcore avoids the clash. The public header is now <wsap_vtcore/wsap_vtcore.h>. Every global symbol uses the wsap_vtcore_ prefix, every macro uses WSAP_VTCORE_, and the shared library is libwsap_vtcore.so.0. The default terminal name is now "wsap_vtcore". The ISA override variable is WSAP_VTCORE_ISA. No other behavior changes. The amalgamation writes wsap_vtcore.c and wsap_vtcore.h. Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Diffstat (limited to 'tests/history_text_test.c')
-rw-r--r--tests/history_text_test.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/tests/history_text_test.c b/tests/history_text_test.c
index 88ca6aa..4ede890 100644
--- a/tests/history_text_test.c
+++ b/tests/history_text_test.c
@@ -1,4 +1,4 @@
-#include "term/term.h"
+#include "wsap_vtcore/wsap_vtcore.h"
#include "term_api.h"
#include <assert.h>
@@ -8,9 +8,9 @@
#include <stdlib.h>
#include <string.h>
-static struct term *new_term(int cols)
+static struct wsap_vtcore *new_term(int cols)
{
- struct term *term = term_new(&(struct term_options){
+ struct wsap_vtcore *term = wsap_vtcore_new(&(struct wsap_vtcore_options){
.size = { .x = cols, .y = 2 },
.scrollback = 100,
});
@@ -18,12 +18,12 @@ static struct term *new_term(int cols)
return term;
}
-static void feed(struct term *term, const char *text)
+static void feed(struct wsap_vtcore *term, const char *text)
{
- term_feed(term, text, strlen(text), 0);
+ wsap_vtcore_feed(term, text, strlen(text), 0);
}
-static void expect_history(struct term *term, int rows, const char *expected)
+static void expect_history(struct wsap_vtcore *term, int rows, const char *expected)
{
char *text = tt_history_text(term, rows);
assert(text);
@@ -36,13 +36,13 @@ static void expect_history(struct term *term, int rows, const char *expected)
static void unicode_and_selection(void)
{
- struct term *term = new_term(16);
+ struct wsap_vtcore *term = new_term(16);
expect_history(term, 100, "");
feed(term, "eฬ๐Ÿ‘ฉโ€๐Ÿ’ป็•Œ\r\nnext\r\nlast");
expect_history(term, 100, "eฬ๐Ÿ‘ฉโ€๐Ÿ’ป็•Œ\n");
expect_history(term, 0, "");
- term_select_start(term, (struct term_vector2i){0}, false, TERM_SELECT_CELL);
- term_select_extend(term, (struct term_vector2i){ .x = 4 }, false);
+ wsap_vtcore_select_start(term, (struct wsap_vtcore_vector2i){0}, false, WSAP_VTCORE_SELECT_CELL);
+ wsap_vtcore_select_extend(term, (struct wsap_vtcore_vector2i){ .x = 4 }, false);
char *before = tt_selection_text(term);
assert(before);
expect_history(term, 100, "eฬ๐Ÿ‘ฉโ€๐Ÿ’ป็•Œ\n");
@@ -54,41 +54,41 @@ static void unicode_and_selection(void)
expect_history(term, 100, "");
feed(term, "\033[?1049l");
expect_history(term, 100, "eฬ๐Ÿ‘ฉโ€๐Ÿ’ป็•Œ\n");
- term_free(term);
+ wsap_vtcore_free(term);
}
static void limits_and_scrolled_view(void)
{
- struct term *term = new_term(8);
+ struct wsap_vtcore *term = new_term(8);
feed(term, "one\r\ntwo\r\nthree\r\nfour\r\nfive");
expect_history(term, 100, "one\ntwo\nthree\n");
expect_history(term, 2, "two\nthree\n");
- term_scroll(term, 2);
+ wsap_vtcore_scroll(term, 2);
expect_history(term, 100, "one\n");
- term_scroll(term, 100);
+ wsap_vtcore_scroll(term, 100);
expect_history(term, 100, "");
- term_scroll_to(term, 0);
- assert(term_resize(term, (struct term_vector2i){ .x = 12, .y = 2 }));
+ wsap_vtcore_scroll_to(term, 0);
+ assert(wsap_vtcore_resize(term, (struct wsap_vtcore_vector2i){ .x = 12, .y = 2 }));
expect_history(term, 100, "one\ntwo\nthree\n");
- term_free(term);
+ wsap_vtcore_free(term);
}
static void wrapped_rows(void)
{
- struct term *term = new_term(4);
+ struct wsap_vtcore *term = new_term(4);
feed(term, "abcdefghi\r\nx\r\ny");
expect_history(term, 100, "abcdefghi\n");
expect_history(term, 2, "efghi\n");
- term_free(term);
+ wsap_vtcore_free(term);
term = new_term(4);
feed(term, "abcdefghijklm");
expect_history(term, 100, "abcdefgh");
- term_free(term);
+ wsap_vtcore_free(term);
}
struct writer {
- struct term *term;
+ struct wsap_vtcore *term;
_Atomic bool done;
};
@@ -106,7 +106,7 @@ static void *write_history(void *userdata)
static void concurrent_history(void)
{
- struct term *term = new_term(16);
+ struct wsap_vtcore *term = new_term(16);
struct writer writer = { .term = term };
pthread_t thread;
assert(pthread_create(&thread, NULL, write_history, &writer) == 0);
@@ -121,7 +121,7 @@ static void concurrent_history(void)
free(text);
} while (!atomic_load(&writer.done));
assert(pthread_join(thread, NULL) == 0);
- term_free(term);
+ wsap_vtcore_free(term);
}
int main(void)