Skip to content

Commit 354ccec

Browse files
authored
Merge pull request #2431 from kaNEGY/test/ts-lsp-allocation-failures
test(ts-lsp): fail when fixture allocation fails
2 parents 0533beb + bb650ca commit 354ccec

1 file changed

Lines changed: 4 additions & 8 deletions

File tree

‎tests/test_ts_lsp.c‎

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,7 @@ TEST(tslsp_nocrash_using_decl) {
716716
TEST(tslsp_nocrash_megasource) {
717717
/* 50 KB of `;` should parse and walk without blowing the stack or arena. */
718718
char *buf = (char *)malloc(50001);
719-
if (!buf)
720-
PASS();
719+
ASSERT_NOT_NULL(buf);
721720
memset(buf, ';', 50000);
722721
buf[50000] = '\0';
723722
CBMFileResult *r = extract_ts(buf);
@@ -3279,8 +3278,7 @@ TEST(tslsp_stress_many_classes) {
32793278
/* 50 classes, each with one method, plus a dispatcher function calling all. */
32803279
enum { BUF_CAP = 200 * 1024 };
32813280
char *buf = (char *)malloc(BUF_CAP);
3282-
if (!buf)
3283-
PASS();
3281+
ASSERT_NOT_NULL(buf);
32843282
char *p = buf;
32853283
char *end = buf + BUF_CAP;
32863284
for (int i = 0; i < 50; i++) {
@@ -3463,8 +3461,7 @@ TEST(tslsp_stress_5000_lines) {
34633461
* doesn't crash, finishes in reasonable time. */
34643462
enum { BUF_CAP = 800 * 1024 };
34653463
char *buf = (char *)malloc(BUF_CAP);
3466-
if (!buf)
3467-
PASS();
3464+
ASSERT_NOT_NULL(buf);
34683465
char *p = buf;
34693466
char *end = buf + BUF_CAP;
34703467
for (int i = 0; i < 200; i++) {
@@ -3531,8 +3528,7 @@ TEST(tslsp_stress_empty_classes_at_scale) {
35313528
/* 500 empty classes — registry stress. */
35323529
enum { BUF_CAP = 40 * 1024 };
35333530
char *buf = (char *)malloc(BUF_CAP);
3534-
if (!buf)
3535-
PASS();
3531+
ASSERT_NOT_NULL(buf);
35363532
char *p = buf;
35373533
char *end = buf + BUF_CAP;
35383534
for (int i = 0; i < 500; i++) {

0 commit comments

Comments
 (0)