diff options
| author | 2020-12-28 23:34:49 +0100 | |
|---|---|---|
| committer | 2020-12-28 23:37:17 +0100 | |
| commit | 3f1267a420bba647289fa907fd285bbc5169de3b (patch) | |
| tree | 6ae2b6187470f55ebfb7f016640867debac14ea2 | |
| parent | update readme with the library status (diff) | |
| download | zig-sqlite-3f1267a420bba647289fa907fd285bbc5169de3b.tar.gz zig-sqlite-3f1267a420bba647289fa907fd285bbc5169de3b.tar.xz zig-sqlite-3f1267a420bba647289fa907fd285bbc5169de3b.zip | |
rename is_ci to in_memory
Diffstat (limited to '')
| -rw-r--r-- | build.zig | 4 | ||||
| -rw-r--r-- | sqlite.zig | 4 |
2 files changed, 4 insertions, 4 deletions
| @@ -14,11 +14,11 @@ pub fn build(b: *Builder) void { | |||
| 14 | linkAll(lib); | 14 | linkAll(lib); |
| 15 | lib.install(); | 15 | lib.install(); |
| 16 | 16 | ||
| 17 | const is_ci = b.option(bool, "is_ci", "Identifies if it runs in a CI environment") orelse false; | 17 | const in_memory = b.option(bool, "in_memory", "Should the tests run with sqlite in memory") orelse false; |
| 18 | 18 | ||
| 19 | var main_tests = b.addTest("sqlite.zig"); | 19 | var main_tests = b.addTest("sqlite.zig"); |
| 20 | main_tests.setBuildMode(mode); | 20 | main_tests.setBuildMode(mode); |
| 21 | main_tests.addBuildOption(bool, "is_ci", is_ci); | 21 | main_tests.addBuildOption(bool, "in_memory", in_memory); |
| 22 | linkAll(main_tests); | 22 | linkAll(main_tests); |
| 23 | 23 | ||
| 24 | const test_step = b.step("test", "Run library tests"); | 24 | const test_step = b.step("test", "Run library tests"); |
| @@ -790,7 +790,7 @@ test "sqlite: db pragma" { | |||
| 790 | testing.expect(foreign_keys != null); | 790 | testing.expect(foreign_keys != null); |
| 791 | testing.expectEqual(@as(usize, 0), foreign_keys.?); | 791 | testing.expectEqual(@as(usize, 0), foreign_keys.?); |
| 792 | 792 | ||
| 793 | if (build_options.is_ci) { | 793 | if (build_options.in_memory) { |
| 794 | const journal_mode = try db.pragma( | 794 | const journal_mode = try db.pragma( |
| 795 | []const u8, | 795 | []const u8, |
| 796 | "journal_mode", | 796 | "journal_mode", |
| @@ -1186,7 +1186,7 @@ test "sqlite: statement iterator" { | |||
| 1186 | } | 1186 | } |
| 1187 | 1187 | ||
| 1188 | fn dbMode() Db.Mode { | 1188 | fn dbMode() Db.Mode { |
| 1189 | return if (build_options.is_ci) blk: { | 1189 | return if (build_options.in_memory) blk: { |
| 1190 | break :blk .{ .Memory = {} }; | 1190 | break :blk .{ .Memory = {} }; |
| 1191 | } else blk: { | 1191 | } else blk: { |
| 1192 | const path = "/tmp/zig-sqlite.db"; | 1192 | const path = "/tmp/zig-sqlite.db"; |