Improve exception integration tests

This commit is contained in:
Patrick Pelissier committed 2024-04-22 23:00:04 +02:00
1 parent ced2719760
commit 9382cdc0f7
1 file changed
+17 -3
+17 -3
View File
@@ -32,7 +32,6 @@ static void test1(unsigned n)
FILE *f = m_core_fopen ("a-estring.dat", "wt"); FILE *f = m_core_fopen ("a-estring.dat", "wt");
assert(f != NULL); assert(f != NULL);
M_TRY(test1) { M_TRY(test1) {
M_LET(obj, test_obj_except__t)
M_LET(str, tmp, string_t) { M_LET(str, tmp, string_t) {
for(unsigned i = 0; i < 10*n; i++) { for(unsigned i = 0; i < 10*n; i++) {
string_push_back(str, (char) (i + 'A')); string_push_back(str, (char) (i + 'A'));
@@ -75,6 +74,11 @@ static void test1(unsigned n)
} }
string_get_str(str, tmp, false); string_get_str(str, tmp, false);
bool b = string_parse_str(tmp, string_get_cstr(str), NULL); bool b = string_parse_str(tmp, string_get_cstr(str), NULL);
string_it_t it;
unsigned i = 0;
for( string_it(it, str); !string_end_p(it); string_next(it)) {
string_it_set_ref(it, str, ' ' + i++);
}
assert(b); assert(b);
} }
} M_CATCH(test1, 0) { } M_CATCH(test1, 0) {
@@ -85,7 +89,6 @@ static void test1(unsigned n)
f = m_core_fopen ("a-estring.dat", "rt"); f = m_core_fopen ("a-estring.dat", "rt");
assert(f != NULL); assert(f != NULL);
M_TRY(test1) { M_TRY(test1) {
M_LET(obj, test_obj_except__t)
M_LET(str, string_t) { M_LET(str, string_t) {
bool b = string_in_str(str, f); bool b = string_in_str(str, f);
(void)b; (void)b;
@@ -98,7 +101,6 @@ static void test1(unsigned n)
f = m_core_fopen ("a-estring.dat", "rt"); f = m_core_fopen ("a-estring.dat", "rt");
assert(f != NULL); assert(f != NULL);
M_TRY(test1) { M_TRY(test1) {
M_LET(obj, test_obj_except__t)
M_LET(str, string_t) { M_LET(str, string_t) {
bool b = m_string_fgets(str, f, M_STRING_READ_FILE); bool b = m_string_fgets(str, f, M_STRING_READ_FILE);
(void)b; (void)b;
@@ -107,6 +109,18 @@ static void test1(unsigned n)
// Nothing to do // Nothing to do
} }
fclose(f); fclose(f);
f = m_core_fopen ("a-estring.dat", "rt");
assert(f != NULL);
M_TRY(test1) {
M_LET(str, string_t) {
bool b = string_fget_word(str, " \t,;.:/!=+", f);
(void)b;
}
} M_CATCH(test1, 0) {
// Nothing to do
}
fclose(f);
} }
int main(void) int main(void)