Skip to content

Commit d70e505

Browse files
committed
Fail in text_in upon agda input
1 parent 53e69de commit d70e505

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/asm.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ static int text_in(STREAM *stream, struct element *i, void *ud)
471471
char next_char = 0;
472472
size_t len = stream->op.fread(&next_char, 1, 1, stream);
473473
if (len > 0 && !isspace(next_char))
474-
return -1;
474+
fatal(0, "Invalid character '%c' (ordinal %#hhx)", next_char, next_char);
475475
return result ? 1 : -1;
476476
}
477477

tests.cmake

+7
Original file line numberDiff line numberDiff line change
@@ -632,6 +632,13 @@ check_failure(
632632
)
633633

634634

635+
check_failure(
636+
NAME "invalid input for text"
637+
COMMAND ${CMAKE_TENYR_COMPILER}
638+
ARGS --format=text -d ${CMAKE_SOURCE_DIR}/test/misc/memh/agda.memh
639+
EXPECT "Invalid character"
640+
)
641+
635642
check_failure(
636643
NAME "invalid input for memh"
637644
COMMAND ${CMAKE_TENYR_COMPILER}

0 commit comments

Comments
 (0)