Fix tests 😖
This commit is contained in:
parent
65f8194a1f
commit
67eb4b97a1
7 changed files with 34 additions and 34 deletions
|
@ -263,7 +263,7 @@ mod tests {
|
||||||
let res = datetime_raw(sql);
|
let res = datetime_raw(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!("\"2012-04-23T18:25:43Z\"", format!("{}", out));
|
assert_eq!("'2012-04-23T18:25:43Z'", format!("{}", out));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -272,7 +272,7 @@ mod tests {
|
||||||
let res = datetime_raw(sql);
|
let res = datetime_raw(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!("\"2012-04-23T18:25:43.563100Z\"", format!("{}", out));
|
assert_eq!("'2012-04-23T18:25:43.563100Z'", format!("{}", out));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -281,7 +281,7 @@ mod tests {
|
||||||
let res = datetime_raw(sql);
|
let res = datetime_raw(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!("\"2012-04-23T18:25:43.000051100Z\"", format!("{}", out));
|
assert_eq!("'2012-04-23T18:25:43.000051100Z'", format!("{}", out));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -290,7 +290,7 @@ mod tests {
|
||||||
let res = datetime_raw(sql);
|
let res = datetime_raw(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!("\"2012-04-24T02:25:43.511Z\"", format!("{}", out));
|
assert_eq!("'2012-04-24T02:25:43.511Z'", format!("{}", out));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -299,6 +299,6 @@ mod tests {
|
||||||
let res = datetime_raw(sql);
|
let res = datetime_raw(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!("\"2012-04-24T02:55:43.511Z\"", format!("{}", out));
|
assert_eq!("'2012-04-24T02:55:43.511Z'", format!("{}", out));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ mod tests {
|
||||||
let res = range(sql);
|
let res = range(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!(r#"person:["USA", 10]..["USA", 100]"#, format!("{}", out));
|
assert_eq!("person:['USA', 10]..['USA', 100]", format!("{}", out));
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
@ -65,7 +65,7 @@ mod tests {
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
r#"person:{ country: "USA", position: 10 }..{ country: "USA", position: 100 }"#,
|
"person:{ country: 'USA', position: 10 }..{ country: 'USA', position: 100 }",
|
||||||
format!("{}", out)
|
format!("{}", out)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -184,7 +184,7 @@ mod tests {
|
||||||
let res = strand(sql);
|
let res = strand(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!(r#""""#, format!("{}", out));
|
assert_eq!(r#"''"#, format!("{}", out));
|
||||||
assert_eq!(out, Strand::from(""));
|
assert_eq!(out, Strand::from(""));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ mod tests {
|
||||||
let res = strand(sql);
|
let res = strand(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!(r#""test""#, format!("{}", out));
|
assert_eq!(r#"'test'"#, format!("{}", out));
|
||||||
assert_eq!(out, Strand::from("test"));
|
assert_eq!(out, Strand::from("test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ mod tests {
|
||||||
let res = strand(sql);
|
let res = strand(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!(r#""test""#, format!("{}", out));
|
assert_eq!(r#"'test'"#, format!("{}", out));
|
||||||
assert_eq!(out, Strand::from("test"));
|
assert_eq!(out, Strand::from("test"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ mod tests {
|
||||||
let res = strand(sql);
|
let res = strand(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!(r#""te"st""#, format!("{}", out));
|
assert_eq!(r#"'te"st'"#, format!("{}", out));
|
||||||
assert_eq!(out, Strand::from(r#"te"st"#));
|
assert_eq!(out, Strand::from(r#"te"st"#));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ mod tests {
|
||||||
let res = strand(sql);
|
let res = strand(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!("\"te\"st\n\tand\u{08}some\u{05d9}\"", format!("{}", out));
|
assert_eq!("'te\"st\n\tand\u{08}some\u{05d9}'", format!("{}", out));
|
||||||
assert_eq!(out, Strand::from("te\"st\n\tand\u{08}some\u{05d9}"));
|
assert_eq!(out, Strand::from("te\"st\n\tand\u{08}some\u{05d9}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -202,7 +202,7 @@ mod tests {
|
||||||
let res = thing(sql);
|
let res = thing(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!(r#"test:{ location: "GBR", year: 2022 }"#, format!("{}", out));
|
assert_eq!("test:{ location: 'GBR', year: 2022 }", format!("{}", out));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
out,
|
out,
|
||||||
Thing {
|
Thing {
|
||||||
|
@ -221,7 +221,7 @@ mod tests {
|
||||||
let res = thing(sql);
|
let res = thing(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!(r#"test:["GBR", 2022]"#, format!("{}", out));
|
assert_eq!("test:['GBR', 2022]", format!("{}", out));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
out,
|
out,
|
||||||
Thing {
|
Thing {
|
||||||
|
|
|
@ -121,7 +121,7 @@ mod tests {
|
||||||
let res = uuid_raw(sql);
|
let res = uuid_raw(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!("\"e72bee20-f49b-11ec-b939-0242ac120002\"", format!("{}", out));
|
assert_eq!("'e72bee20-f49b-11ec-b939-0242ac120002'", format!("{}", out));
|
||||||
assert_eq!(out, Uuid::from("e72bee20-f49b-11ec-b939-0242ac120002"));
|
assert_eq!(out, Uuid::from("e72bee20-f49b-11ec-b939-0242ac120002"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -131,7 +131,7 @@ mod tests {
|
||||||
let res = uuid_raw(sql);
|
let res = uuid_raw(sql);
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!("\"b19bc00b-aa98-486c-ae37-c8e1c54295b1\"", format!("{}", out));
|
assert_eq!("'b19bc00b-aa98-486c-ae37-c8e1c54295b1'", format!("{}", out));
|
||||||
assert_eq!(out, Uuid::from("b19bc00b-aa98-486c-ae37-c8e1c54295b1"));
|
assert_eq!(out, Uuid::from("b19bc00b-aa98-486c-ae37-c8e1c54295b1"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,6 @@ mod tests {
|
||||||
assert!(res.is_ok());
|
assert!(res.is_ok());
|
||||||
let out = res.unwrap().1;
|
let out = res.unwrap().1;
|
||||||
assert_eq!(out, Version(Datetime::from("2020-01-01T00:00:00Z")));
|
assert_eq!(out, Version(Datetime::from("2020-01-01T00:00:00Z")));
|
||||||
assert_eq!("VERSION \"2020-01-01T00:00:00Z\"", format!("{}", out));
|
assert_eq!("VERSION '2020-01-01T00:00:00Z'", format!("{}", out));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -258,12 +258,12 @@ async fn define_statement_event_when_event() -> Result<(), Error> {
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result?;
|
let tmp = res.remove(0).result?;
|
||||||
let val = Value::parse(
|
let val = Value::parse(
|
||||||
"{
|
r#"{
|
||||||
ev: { test: 'DEFINE EVENT test ON user WHEN $event = \"CREATE\" THEN (CREATE activity SET user = $this, value = $after.email, action = $event)' },
|
ev: { test: "DEFINE EVENT test ON user WHEN $event = 'CREATE' THEN (CREATE activity SET user = $this, value = $after.email, action = $event)" },
|
||||||
fd: {},
|
fd: {},
|
||||||
ft: {},
|
ft: {},
|
||||||
ix: {},
|
ix: {},
|
||||||
}",
|
}"#,
|
||||||
);
|
);
|
||||||
assert_eq!(tmp, val);
|
assert_eq!(tmp, val);
|
||||||
//
|
//
|
||||||
|
@ -428,12 +428,12 @@ async fn define_statement_field_value() -> Result<(), Error> {
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result?;
|
let tmp = res.remove(0).result?;
|
||||||
let val = Value::parse(
|
let val = Value::parse(
|
||||||
"{
|
r#"{
|
||||||
ev: {},
|
ev: {},
|
||||||
fd: { test: 'DEFINE FIELD test ON user VALUE $value OR \"GBR\"' },
|
fd: { test: "DEFINE FIELD test ON user VALUE $value OR 'GBR'" },
|
||||||
ft: {},
|
ft: {},
|
||||||
ix: {},
|
ix: {},
|
||||||
}",
|
}"#,
|
||||||
);
|
);
|
||||||
assert_eq!(tmp, val);
|
assert_eq!(tmp, val);
|
||||||
//
|
//
|
||||||
|
@ -492,12 +492,12 @@ async fn define_statement_field_type_value_assert() -> Result<(), Error> {
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result?;
|
let tmp = res.remove(0).result?;
|
||||||
let val = Value::parse(
|
let val = Value::parse(
|
||||||
"{
|
r#"{
|
||||||
ev: {},
|
ev: {},
|
||||||
fd: { test: 'DEFINE FIELD test ON user TYPE string VALUE $value OR \"GBR\" ASSERT $value != NONE AND $value = /[A-Z]{3}/' },
|
fd: { test: "DEFINE FIELD test ON user TYPE string VALUE $value OR 'GBR' ASSERT $value != NONE AND $value = /[A-Z]{3}/" },
|
||||||
ft: {},
|
ft: {},
|
||||||
ix: {},
|
ix: {},
|
||||||
}",
|
}"#,
|
||||||
);
|
);
|
||||||
assert_eq!(tmp, val);
|
assert_eq!(tmp, val);
|
||||||
//
|
//
|
||||||
|
@ -688,7 +688,7 @@ async fn define_statement_index_single_unique() -> Result<(), Error> {
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
tmp.err(),
|
tmp.err(),
|
||||||
Some(e) if e.to_string() == r#"Database index `test` already contains "test@surrealdb.com", with record `user:2`"#
|
Some(e) if e.to_string() == r#"Database index `test` already contains 'test@surrealdb.com', with record `user:2`"#
|
||||||
));
|
));
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
|
@ -750,13 +750,13 @@ async fn define_statement_index_multiple_unique() -> Result<(), Error> {
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
tmp.err(),
|
tmp.err(),
|
||||||
Some(e) if e.to_string() == r#"Database index `test` already contains ["apple", "test@surrealdb.com"], with record `user:3`"#
|
Some(e) if e.to_string() == r#"Database index `test` already contains ['apple', 'test@surrealdb.com'], with record `user:3`"#
|
||||||
));
|
));
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
tmp.err(),
|
tmp.err(),
|
||||||
Some(e) if e.to_string() == r#"Database index `test` already contains ["tesla", "test@surrealdb.com"], with record `user:4`"#
|
Some(e) if e.to_string() == r#"Database index `test` already contains ['tesla', 'test@surrealdb.com'], with record `user:4`"#
|
||||||
));
|
));
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
|
@ -769,7 +769,7 @@ async fn define_statement_index_multiple_unique() -> Result<(), Error> {
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
tmp.err(),
|
tmp.err(),
|
||||||
Some(e) if e.to_string() == r#"Database index `test` already contains ["tesla", "test@surrealdb.com"], with record `user:4`"#
|
Some(e) if e.to_string() == r#"Database index `test` already contains ['tesla', 'test@surrealdb.com'], with record `user:4`"#
|
||||||
));
|
));
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
|
@ -809,13 +809,13 @@ async fn define_statement_index_single_unique_existing() -> Result<(), Error> {
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
tmp.err(),
|
tmp.err(),
|
||||||
Some(e) if e.to_string() == r#"Database index `test` already contains "test@surrealdb.com", with record `user:3`"#
|
Some(e) if e.to_string() == r#"Database index `test` already contains 'test@surrealdb.com', with record `user:3`"#
|
||||||
));
|
));
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
tmp.err(),
|
tmp.err(),
|
||||||
Some(e) if e.to_string() == r#"Database index `test` already contains "test@surrealdb.com", with record `user:3`"#
|
Some(e) if e.to_string() == r#"Database index `test` already contains 'test@surrealdb.com', with record `user:3`"#
|
||||||
));
|
));
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result?;
|
let tmp = res.remove(0).result?;
|
||||||
|
@ -863,13 +863,13 @@ async fn define_statement_index_multiple_unique_existing() -> Result<(), Error>
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
tmp.err(),
|
tmp.err(),
|
||||||
Some(e) if e.to_string() == r#"Database index `test` already contains ["apple", "test@surrealdb.com"], with record `user:3`"#
|
Some(e) if e.to_string() == r#"Database index `test` already contains ['apple', 'test@surrealdb.com'], with record `user:3`"#
|
||||||
));
|
));
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result;
|
let tmp = res.remove(0).result;
|
||||||
assert!(matches!(
|
assert!(matches!(
|
||||||
tmp.err(),
|
tmp.err(),
|
||||||
Some(e) if e.to_string() == r#"Database index `test` already contains ["apple", "test@surrealdb.com"], with record `user:3`"#
|
Some(e) if e.to_string() == r#"Database index `test` already contains ['apple', 'test@surrealdb.com'], with record `user:3`"#
|
||||||
));
|
));
|
||||||
//
|
//
|
||||||
let tmp = res.remove(0).result?;
|
let tmp = res.remove(0).result?;
|
||||||
|
|
Loading…
Reference in a new issue