Skip to content

Commit bd9b7de

Browse files
committed
Added a preprocessor macro to force load embedded library instead of external extension
1 parent 17f8160 commit bd9b7de

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

test/main.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,16 @@ int test_serialization (const char *db_path, bool load_functions, int nstep) {
3232
int rc = sqlite3_open(db_path, &db);
3333
if (rc != SQLITE_OK) goto abort_test;
3434

35+
#if JS_LOAD_EMBEDDED
36+
rc = sqlite3_js_init(db, NULL, NULL);
37+
#else
3538
// enable load extension
3639
rc = sqlite3_enable_load_extension(db, 1);
3740
if (rc != SQLITE_OK) goto abort_test;
3841

3942
rc = db_exec(db, "SELECT load_extension('./dist/js');");
4043
if (rc != SQLITE_OK) goto abort_test;
44+
#endif
4145

4246
rc = db_exec(db, (load_functions) ? "SELECT js_init_table(1);" : "SELECT js_init_table();");
4347
if (rc != SQLITE_OK) goto abort_test;
@@ -69,12 +73,16 @@ int test_execution (void) {
6973
int rc = sqlite3_open(":memory:", &db);
7074
if (rc != SQLITE_OK) goto abort_test;
7175

76+
#if JS_LOAD_EMBEDDED
77+
rc = sqlite3_js_init(db, NULL, NULL);
78+
#else
7279
// enable load extension
7380
rc = sqlite3_enable_load_extension(db, 1);
7481
if (rc != SQLITE_OK) goto abort_test;
7582

7683
rc = db_exec(db, "SELECT load_extension('./dist/js');");
7784
if (rc != SQLITE_OK) goto abort_test;
85+
#endif
7886

7987
// context
8088
printf("Testing context\n");

0 commit comments

Comments
 (0)