Skip to content

Commit fd8d07e

Browse files
committed
test: add -DSQLITE_DQS=0 when building for unittest
1 parent 3202706 commit fd8d07e

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ $(TEST_TARGET): $(TEST_OBJ)
181181
$(BUILD_RELEASE)/%.o: %.c
182182
$(CC) $(CFLAGS) -O3 -fPIC -c $< -o $@
183183
$(BUILD_TEST)/sqlite3.o: $(SQLITE_DIR)/sqlite3.c
184-
$(CC) $(CFLAGS) -DSQLITE_CORE -c $< -o $@
184+
$(CC) $(CFLAGS) -DSQLITE_DQS=0 -DSQLITE_CORE -c $< -o $@
185185
$(BUILD_TEST)/%.o: %.c
186186
$(CC) $(T_CFLAGS) -c $< -o $@
187187

test/unit.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1956,8 +1956,13 @@ bool do_test_internal_functions (void) {
19561956
int rc = sqlite3_open(":memory:", &db);
19571957
if (rc != SQLITE_OK) goto abort_test;
19581958

1959-
rc = sqlite3_exec(db, "SELECT \"double-quoted string literal misfeature\"", NULL, NULL, NULL);
1960-
if (rc != SQLITE_ERROR) goto abort_test;
1959+
sql = "SELECT \"double-quoted string literal misfeature\"";
1960+
rc = sqlite3_exec(db, sql, NULL, NULL, NULL);
1961+
if (rc != SQLITE_ERROR) {
1962+
printf("invalid result code for the following query, expected 1 (ERROR), got %d: '%s'\n", rc, sql);
1963+
printf("the unittest must be built with -DSQLITE_DQS=0\n");
1964+
goto abort_test;
1965+
}
19611966

19621967
sql = "CREATE TABLE foo (name TEXT PRIMARY KEY NOT NULL, age INTEGER UNIQUE);";
19631968
rc = sqlite3_exec(db, sql, NULL, NULL, NULL);

0 commit comments

Comments
 (0)