- Added tests for Cons Canvas, Histogram, HUD, Pal, Pager, Pipe, RGB, HTML, Line. - Fixed rz_str_ansi_filter null terminator bug. - Refactored test_cons.c by splitting it into smaller files. - Improved many existing assertions to verify actual output content. - Restored mu_assert_notnull checks for better reliability. Co-authored-by: Maijin <maijin21@gmail.com>
30 lines
751 B
C
30 lines
751 B
C
// SPDX-FileCopyrightText: 2026 Maijin <maijin21@gmail.com>
|
|
// SPDX-License-Identifier: LGPL-3.0-only
|
|
|
|
#include <rz_cons.h>
|
|
#include "minunit.h"
|
|
|
|
#include "../../librz/cons/pager.c"
|
|
|
|
bool test_pager_splitlines(void) {
|
|
char *s = strdup("line1\nline2\nline3");
|
|
int count = 0;
|
|
int *lines = pager_splitlines(s, &count);
|
|
|
|
mu_assert_eq(count, 3, "Split 3 lines");
|
|
mu_assert_eq(lines[0], 0, "First line offset");
|
|
mu_assert_streq(s + lines[0], "line1", "First line content");
|
|
mu_assert_streq(s + lines[1], "line2", "Second line content");
|
|
mu_assert_streq(s + lines[2], "line3", "Third line content");
|
|
|
|
free(lines);
|
|
free(s);
|
|
mu_end;
|
|
}
|
|
|
|
bool all_tests() {
|
|
mu_run_test(test_pager_splitlines);
|
|
return tests_passed != tests_run;
|
|
}
|
|
|
|
mu_main(all_tests)
|