summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorNathan Gass2023-02-28 14:46:49 +0100
committerNathan Gass2023-02-28 18:57:56 +0100
commit305fa5f80db7691597abc607020622e7c065eaed (patch)
treeb1351a727eb4db96e25db2c5891f96c60a9472a5 /test
parent738295ba1efa2bbb4eefca5966fe87474df3ab30 (diff)
downloaditools-305fa5f80db7691597abc607020622e7c065eaed.tar.gz
itools-305fa5f80db7691597abc607020622e7c065eaed.tar.bz2
itools-305fa5f80db7691597abc607020622e7c065eaed.zip
Revert "special handling of boolean columns (accept false as value without warning)"
This reverts commit efeb9c4a97668672f8aaa263e4937461f0b1b725.
Diffstat (limited to 'test')
-rwxr-xr-xtest/it_dbi.t16
1 files changed, 8 insertions, 8 deletions
diff --git a/test/it_dbi.t b/test/it_dbi.t
index 0305166..ff0303a 100755
--- a/test/it_dbi.t
+++ b/test/it_dbi.t
@@ -45,8 +45,8 @@ try {
is(it::match('syntax', $e->getMessage()), 'syntax', "Syntax error triggers error");
}
-$record->insert(['x' => 42, 'y' => 0.0001, 'z' => 0, 'foo' => null, 'flag' => true]);
-$record->insert(['foo' => "bar", 'y' => 1e-10, 'z' => 0, 'flag' => false]);
+$record->insert(['x' => 42, 'y' => 0.0001, 'z' => 0, 'foo' => null, 'flag' => 1]);
+$record->insert(['foo' => "bar", 'y' => 1e-10, 'z' => 0, 'flag' => 0]);
$record->insert(['x' => 64738, 'y' => 1, 'z' => 0, 'foo' => "q'uux"]);
is(
@@ -67,9 +67,9 @@ is(
[1, 42, 0.0001, null],
"read"
);
-is($record->flag, true, "read true boolean");
+ok(!!$record->flag, "read true boolean");
$record->read(2);
-is($record->flag, false, "read false boolean");
+ok(!$record->flag, "read false boolean");
is(
$record->select(),
@@ -517,17 +517,17 @@ static function _write_preprocess($data)
$record = new my_dbi_test;
$record->delete(['WHERE TRUE' ]);
-$record->upsert(['ID' => 1, 'x' => 42, 'y' => 2.5, 'foo' => ['value' => "a"], 'flag' => false]);
+$record->upsert(['ID' => 1, 'x' => 42, 'y' => 2.5, 'foo' => ['value' => "a"], 'flag' => 0]);
$record->read(1);
is($record->x, 42, 'value of x after reading with _read_postprocess');
-is($record->_data, ["ID" => 1, "x" => 42, 'y' => 2.5, 'z' => NULL, 'foo' => '{"value":"a"}', 'flag' => false], 'data after reading with _read_postprocess');
+is($record->_data, ["ID" => 1, "x" => 42, 'y' => 2.5, 'z' => NULL, 'foo' => '{"value":"a"}', 'flag' => 0], 'data after reading with _read_postprocess');
is($record->foo, ['value' => "a"], 'field after reading with _read_postprocess');
$record2 = new it_dbi_test;
$record2->read(1);
is($record2->x, 43, 'raw value of x after writing with _write_preprocess');
-is($record2->_data, ["ID" => 1, "x" => 43, 'y' => 2.5, 'z' => NULL, 'foo' => '{"value":"a"}', 'flag' => false], 'raw data after writing with _write_preprocess');
+is($record2->_data, ["ID" => 1, "x" => 43, 'y' => 2.5, 'z' => NULL, 'foo' => '{"value":"a"}', 'flag' => 0], 'raw data after writing with _write_preprocess');
$record->update(['foo' => ['value' => "b"]]);
-is($record->_data, ["ID" => 1, "x" => 42, 'y' => 2.5, 'z' => NULL, 'foo' => '{"value":"b"}', 'flag' => false], 'raw data after updating with _write_preprocess');
+is($record->_data, ["ID" => 1, "x" => 42, 'y' => 2.5, 'z' => NULL, 'foo' => '{"value":"b"}', 'flag' => 0], 'raw data after updating with _write_preprocess');
is($record->foo, ['value' => "b"], 'field data after updating with _write_preprocess');