Skip to content

Commit 8bf13b6

Browse files
committed
0.3.11
Use the more common standard of lowercase for boolean strings
1 parent cc62497 commit 8bf13b6

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

Diff for: src/data/value/cast.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ impl Cast<bool> for Value {
4040
}
4141
}
4242
Value::Str(value) => match value.to_uppercase().as_str() {
43-
"TRUE" => true,
44-
"FALSE" => false,
43+
"true" => true,
44+
"false" => false,
4545
_ => return Err(failed_cast(&Value::Str(value), ValueType::Bool)),
4646
},
4747
Value::Null => return Err(failed_cast(&self, ValueType::Bool)),
@@ -121,7 +121,7 @@ impl Cast<f64> for Value {
121121
impl Cast<String> for Value {
122122
fn cast(self) -> Result<String> {
123123
Ok(match self {
124-
Value::Bool(value) => (if value { "TRUE" } else { "FALSE" }).to_string(),
124+
Value::Bool(value) => (if value { "true" } else { "false" }).to_string(),
125125
Value::U64(value) => lexical::to_string(value),
126126
Value::I64(value) => lexical::to_string(value),
127127
Value::F64(value) => lexical::to_string(value),

Diff for: tests/abstract/cast.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ crate::util_macros::testcase!(
2929
cast!(F64(1.0) => Float(None) , F64(1.0));
3030

3131
// Boolean
32-
cast!(Str("TRUE".to_owned()) => Boolean, Bool(true));
33-
cast!(Str("FALSE".to_owned()) => Boolean, Bool(false));
32+
cast!(Str("true".to_owned()) => Boolean, Bool(true));
33+
cast!(Str("false".to_owned()) => Boolean, Bool(false));
3434
cast!(I64(1) => Boolean, Bool(true));
3535
cast!(I64(0) => Boolean, Bool(false));
3636
cast!(F64(1.0) => Boolean, Bool(true));
@@ -58,8 +58,8 @@ crate::util_macros::testcase!(
5858
cast!(Null => Float(None), Null);
5959

6060
// Text
61-
cast!(Bool(true) => Text, Str("TRUE".to_owned()));
62-
cast!(Bool(false) => Text, Str("FALSE".to_owned()));
61+
cast!(Bool(true) => Text, Str("true".to_owned()));
62+
cast!(Bool(false) => Text, Str("false".to_owned()));
6363
cast!(I64(11) => Text, Str("11".to_owned()));
6464
cast!(F64(1.0) => Text, Str("1.0".to_owned()));
6565
cast!(Null => Text, Null);

Diff for: tests/functionality/api/cast_any.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ crate::util_macros::testcase!(
33
{
44
use multisql::{Cast, Value::*};
55
let bool_equivs = vec![
6-
(Bool(false), Str(String::from("FALSE"))),
6+
(Bool(false), Str(String::from("false"))),
77
(Bool(false), I64(0)),
88
(Bool(false), F64(0.0)),
9-
(Bool(true), Str(String::from("TRUE"))),
9+
(Bool(true), Str(String::from("true"))),
1010
(Bool(true), I64(1)),
1111
(Bool(true), F64(1.0)),
1212
];
@@ -51,10 +51,10 @@ crate::util_macros::testcase!(
5151
});
5252

5353
let str_equivs = vec![
54-
(Str(String::from("FALSE")), Bool(false)),
54+
(Str(String::from("false")), Bool(false)),
5555
(Str(String::from("0")), I64(0)),
5656
(Str(String::from("0.0")), F64(0.0)),
57-
(Str(String::from("TRUE")), Bool(true)),
57+
(Str(String::from("true")), Bool(true)),
5858
(Str(String::from("1")), I64(1)),
5959
(Str(String::from("1.0")), F64(1.0)),
6060
];

Diff for: tests/functionality/query/function/func_cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ crate::util_macros::testcase!(
5757
);
5858
crate::util_macros::assert_select!(glue, "
5959
SELECT CAST(TRUE AS TEXT) AS cast FROM Item
60-
" => cast = Str: (String::from("TRUE"))
60+
" => cast = Str: (String::from("true"))
6161
);
6262
/*crate::util_macros::assert_select!(glue, "
6363
SELECT CAST(NULL AS TEXT) AS cast FROM Item

Diff for: tests/functionality/query/function/misc_func_cast.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ crate::util_macros::testcase!(
1919
);
2020
crate::util_macros::assert_select!(glue, "
2121
SELECT CAST(flag AS TEXT) AS cast FROM Item
22-
" => cast = Str: (String::from("TRUE"))
22+
" => cast = Str: (String::from("true"))
2323
);
2424
/*(
2525
r#"SELECT CAST(ratio AS INTEGER) AS cast FROM Item"#,

0 commit comments

Comments
 (0)