Remove most instances of #[cfg(feature(bigdecimal))] in tests (#910)

This commit is contained in:
Andrew Lamb 2023-07-17 14:19:51 -04:00 committed by GitHub
parent a50671d95d
commit 4efe55dd8a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 28 additions and 90 deletions

View file

@ -259,13 +259,7 @@ fn parse_set_variables() {
local: true,
hivevar: false,
variable: ObjectName(vec!["autocommit".into()]),
value: vec![Expr::Value(Value::Number(
#[cfg(not(feature = "bigdecimal"))]
"1".to_string(),
#[cfg(feature = "bigdecimal")]
bigdecimal::BigDecimal::from(1),
false
))],
value: vec![Expr::Value(number("1"))],
}
);
}
@ -643,7 +637,6 @@ fn parse_create_table_unsigned() {
}
#[test]
#[cfg(not(feature = "bigdecimal"))]
fn parse_simple_insert() {
let sql = r"INSERT INTO tasks (title, priority) VALUES ('Test Some Inserts', 1), ('Test Entry 2', 2), ('Test Entry 3', 3)";
@ -668,15 +661,15 @@ fn parse_simple_insert() {
Expr::Value(Value::SingleQuotedString(
"Test Some Inserts".to_string()
)),
Expr::Value(Value::Number("1".to_string(), false))
Expr::Value(number("1"))
],
vec![
Expr::Value(Value::SingleQuotedString("Test Entry 2".to_string())),
Expr::Value(Value::Number("2".to_string(), false))
Expr::Value(number("2"))
],
vec![
Expr::Value(Value::SingleQuotedString("Test Entry 3".to_string())),
Expr::Value(Value::Number("3".to_string(), false))
Expr::Value(number("3"))
]
]
})),
@ -895,6 +888,13 @@ fn parse_select_with_numeric_prefix_column_name() {
}
}
// Don't run with bigdecimal as it fails like this on rust beta:
//
// 'parse_select_with_concatenation_of_exp_number_and_numeric_prefix_column'
// panicked at 'assertion failed: `(left == right)`
//
// left: `"SELECT 123e4, 123col_$@123abc FROM \"table\""`,
// right: `"SELECT 1230000, 123col_$@123abc FROM \"table\""`', src/test_utils.rs:114:13
#[cfg(not(feature = "bigdecimal"))]
#[test]
fn parse_select_with_concatenation_of_exp_number_and_numeric_prefix_column() {
@ -907,10 +907,7 @@ fn parse_select_with_concatenation_of_exp_number_and_numeric_prefix_column() {
distinct: None,
top: None,
projection: vec![
SelectItem::UnnamedExpr(Expr::Value(Value::Number(
"123e4".to_string(),
false
))),
SelectItem::UnnamedExpr(Expr::Value(number("123e4"))),
SelectItem::UnnamedExpr(Expr::Identifier(Ident::new("123col_$@123abc")))
],
into: None,
@ -1072,7 +1069,6 @@ fn parse_alter_table_change_column() {
}
#[test]
#[cfg(not(feature = "bigdecimal"))]
fn parse_substring_in_select() {
let sql = "SELECT DISTINCT SUBSTRING(description, 0, 1) FROM test";
match mysql().one_statement_parses_to(
@ -1091,14 +1087,8 @@ fn parse_substring_in_select() {
value: "description".to_string(),
quote_style: None
})),
substring_from: Some(Box::new(Expr::Value(Value::Number(
"0".to_string(),
false
)))),
substring_for: Some(Box::new(Expr::Value(Value::Number(
"1".to_string(),
false
))))
substring_from: Some(Box::new(Expr::Value(number("0")))),
substring_for: Some(Box::new(Expr::Value(number("1"))))
})],
into: None,
from: vec![TableWithJoins {