mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Messing with tests
This commit is contained in:
@@ -235,10 +235,10 @@ static int nativeRead(Toy_Interpreter* interpreter, Toy_LiteralArray* arguments)
|
||||
break;
|
||||
}
|
||||
|
||||
case TOY_LITERAL_STRING: {
|
||||
case TOY_LITERAL_STRING: { //BUG: needs a terminator to show how much to read
|
||||
char value[TOY_MAX_STRING_LENGTH] = {0};
|
||||
fread(value, sizeof(char), TOY_MAX_STRING_LENGTH - 1, file->fp);
|
||||
value[TOY_MAX_STRING_LENGTH - 1] = '\0';
|
||||
size_t size = fread(value, sizeof(char), TOY_MAX_STRING_LENGTH - 1, file->fp);
|
||||
value[size] = '\0';
|
||||
|
||||
resultLiteral = TOY_TO_STRING_LITERAL(Toy_createRefString(value));
|
||||
|
||||
|
||||
@@ -178,7 +178,6 @@ static Toy_Token makeIntegerOrFloat(Toy_Lexer* lexer) {
|
||||
static bool isEscapableCharacter(char c) {
|
||||
switch (c) {
|
||||
case 'n':
|
||||
case 'r':
|
||||
case 't':
|
||||
case '\\':
|
||||
case '"':
|
||||
|
||||
@@ -281,9 +281,6 @@ static Toy_Opcode string(Toy_Parser* parser, Toy_ASTNode** nodeHandle) {
|
||||
case 'n':
|
||||
buffer[strLength++] = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
buffer[strLength++] = '\r';
|
||||
break;
|
||||
case 't':
|
||||
buffer[strLength++] = '\t';
|
||||
break;
|
||||
|
||||
@@ -121,12 +121,13 @@ fn reset() {
|
||||
assert reader.seek("end", -2) == true, "seek from end failed";
|
||||
|
||||
contents = reader.read(string);
|
||||
assert (contents == "!\n" || contents == "\r\n"), "seek failed to move file position (2nd)";
|
||||
print ">>>(" + contents + ")" + string( contents.length() );
|
||||
assert contents == "\n", "seek failed to move file position (2nd)";
|
||||
|
||||
assert reader.seek("cur", -2) == true, "seek from cur failed";
|
||||
|
||||
contents = reader.read(string);
|
||||
assert (contents == "!\n" || contents == "\r\n"), "seek failed to move file position (3rd)";
|
||||
assert contents == "\n", "seek failed to move file position (3rd)";
|
||||
|
||||
assert reader.seek("CUR", 0) == false, "seek origin failed (1st)";
|
||||
assert reader.seek("End", 0) == false, "seek origin failed (2nd)";
|
||||
|
||||
@@ -44,7 +44,7 @@ void runBinaryWithLibrary(const unsigned char* tb, size_t size, const char* libr
|
||||
Toy_initInterpreter(&interpreter);
|
||||
|
||||
//NOTE: supress print output for testing
|
||||
Toy_setInterpreterPrint(&interpreter, noPrintFn);
|
||||
// Toy_setInterpreterPrint(&interpreter, noPrintFn);
|
||||
Toy_setInterpreterAssert(&interpreter, assertWrapper);
|
||||
Toy_setInterpreterError(&interpreter, errorWrapper);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user