mirror of
https://github.com/tursodatabase/limbo.git
synced 2025-07-07 12:35:00 +00:00
fix tests and return nan as null
This commit is contained in:
parent
922945e819
commit
8b9f34af71
5 changed files with 325 additions and 292 deletions
|
@ -708,7 +708,11 @@ impl<'a> Limbo<'a> {
|
|||
if i > 0 {
|
||||
let _ = self.writer.write(b"|");
|
||||
}
|
||||
let _ = self.writer.write(format!("{}", value).as_bytes())?;
|
||||
if matches!(value, OwnedValue::Null) {
|
||||
let _ = self.writer.write(self.opts.null_value.as_bytes())?;
|
||||
} else {
|
||||
let _ = self.writer.write(format!("{}", value).as_bytes())?;
|
||||
}
|
||||
}
|
||||
let _ = self.writeln("");
|
||||
}
|
||||
|
@ -759,7 +763,7 @@ impl<'a> Limbo<'a> {
|
|||
for (idx, value) in record.get_values().iter().enumerate() {
|
||||
let (content, alignment) = match value {
|
||||
OwnedValue::Null => {
|
||||
(format!("{}", value), CellAlignment::Left)
|
||||
(self.opts.null_value.clone(), CellAlignment::Left)
|
||||
}
|
||||
OwnedValue::Integer(_) => {
|
||||
(format!("{}", value), CellAlignment::Right)
|
||||
|
|
|
@ -150,7 +150,7 @@ impl ExternalAggState {
|
|||
}
|
||||
}
|
||||
|
||||
/// Guys please use Display trait for all limbos output
|
||||
/// Please use Display trait for all limbo output so we have single origin of truth
|
||||
/// When you need value as string:
|
||||
/// ---GOOD---
|
||||
/// format!("{}", value);
|
||||
|
@ -169,7 +169,9 @@ impl Display for OwnedValue {
|
|||
}
|
||||
Self::Float(fl) => {
|
||||
let fl = *fl;
|
||||
|
||||
if fl.is_nan() {
|
||||
return write!(f, "");
|
||||
}
|
||||
// handle negative 0
|
||||
if fl == -0.0 {
|
||||
return write!(f, "{:.1}", fl.abs());
|
||||
|
|
|
@ -3917,7 +3917,7 @@ fn exec_randomblob(reg: &OwnedValue) -> OwnedValue {
|
|||
|
||||
fn exec_quote(value: &OwnedValue) -> OwnedValue {
|
||||
match value {
|
||||
OwnedValue::Null => OwnedValue::build_text(&OwnedValue::Null.to_string()),
|
||||
OwnedValue::Null => OwnedValue::build_text("NULL"),
|
||||
OwnedValue::Integer(_) | OwnedValue::Float(_) => value.to_owned(),
|
||||
OwnedValue::Blob(_) => todo!(),
|
||||
OwnedValue::Text(s) => {
|
||||
|
|
23
licenses/core/libm-mit-license.md
Normal file
23
licenses/core/libm-mit-license.md
Normal file
|
@ -0,0 +1,23 @@
|
|||
Permission is hereby granted, free of charge, to any
|
||||
person obtaining a copy of this software and associated
|
||||
documentation files (the "Software"), to deal in the
|
||||
Software without restriction, including without
|
||||
limitation the rights to use, copy, modify, merge,
|
||||
publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software
|
||||
is furnished to do so, subject to the following
|
||||
conditions:
|
||||
|
||||
The above copyright notice and this permission notice
|
||||
shall be included in all copies or substantial portions
|
||||
of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
||||
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
||||
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
||||
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
||||
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
||||
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue