added a few more test cases
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
hyung-hwan 2024-05-05 14:13:46 +09:00
parent 4ed8651821
commit 3296b5e545
2 changed files with 48 additions and 35 deletions

View File

@ -608,12 +608,10 @@ static hawk_pio_pid_t standard_fork_and_exec (hawk_pio_t* pio, int pipes[], para
static int set_pipe_nonblock (hawk_pio_t* pio, hawk_pio_hnd_t fd, int enabled) static int set_pipe_nonblock (hawk_pio_t* pio, hawk_pio_hnd_t fd, int enabled)
{ {
#if defined(O_NONBLOCK) #if defined(O_NONBLOCK)
int flag = HAWK_FCNTL (fd, F_GETFL, 0); int flag = HAWK_FCNTL (fd, F_GETFL, 0);
if (flag >= 0) flag = HAWK_FCNTL(fd, F_SETFL, (enabled? (flag | O_NONBLOCK): (flag & ~O_NONBLOCK))); if (flag >= 0) flag = HAWK_FCNTL(fd, F_SETFL, (enabled? (flag | O_NONBLOCK): (flag & ~O_NONBLOCK)));
if (flag <= -1) hawk_gem_seterrnum (pio->gem, HAWK_NULL, hawk_syserr_to_errnum(errno)); if (flag <= -1) hawk_gem_seterrnum (pio->gem, HAWK_NULL, hawk_syserr_to_errnum(errno));
return flag; return flag;
#else #else
hawk_gem_seterrnum (pio->gem, HAWK_NULL, HAWK_ENOIMPL); hawk_gem_seterrnum (pio->gem, HAWK_NULL, HAWK_ENOIMPL);
return -1; return -1;
@ -925,7 +923,7 @@ create_process:
#endif #endif
} }
if (dupcmd == HAWK_NULL) goto oops; if (HAWK_UNLIKELY(!dupcmd)) goto oops;
apiret = CreateProcess( apiret = CreateProcess(
HAWK_NULL, /* LPCTSTR lpApplicationName */ HAWK_NULL, /* LPCTSTR lpApplicationName */
@ -1236,7 +1234,7 @@ create_process:
mn = hawk_count_oocstr(cmd); mn = hawk_count_oocstr(cmd);
cmd_line = hawk_dupucstrarr(pio->gem, strarr HAWK_NULL); cmd_line = hawk_dupucstrarr(pio->gem, strarr HAWK_NULL);
if (cmd_line == HAWK_NULL) goto oops; if (HAWK_UNLIKELY(!cmd_line)) goto oops;
#else #else
if (flags & HAWK_PIO_BCSTRCMD) if (flags & HAWK_PIO_BCSTRCMD)
{ {
@ -1248,12 +1246,12 @@ create_process:
mn = hawk_count_bcstr((const hawk_bch_t*)cmd); mn = hawk_count_bcstr((const hawk_bch_t*)cmd);
cmd_line = hawk_dupbcstrarr(pio->gem, mbsarr, HAWK_NULL); cmd_line = hawk_dupbcstrarr(pio->gem, mbsarr, HAWK_NULL);
if (cmd_line == HAWK_NULL) goto oops; if (HAWK_UNLIKELY(!cmd_line)) goto oops;
} }
else else
{ {
cmd_line = hawk_gem_duputobcstr(gem, cmd, &mn); cmd_line = hawk_gem_duputobcstr(gem, cmd, &mn);
if (!cmd_line) goto oops; /* illegal sequence in cmd or out of memory */ if (HAWK_UNLIKELY(!cmd_line)) goto oops; /* illegal sequence in cmd or out of memory */
} }
#endif #endif

View File

@ -2,7 +2,22 @@ BEGIN {
##ERROR: unexpected end of input ##ERROR: unexpected end of input
--- ---
function abc(x { ##ERROR: comma expected in place of function abc(x { ##ERROR: comma expected in place of '{'
}
---
function abc (x, ...,) { ##ERROR: right parenthesis expected in place of ','
}
---
function abc (x, ..., a) { ##ERROR: right parenthesis expected in place of ','
}
---
function abc (... ...) { ##ERROR: right parenthesis expected in place of '...'
} }
--- ---