Skip to content

Commit

Permalink
Fix all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
afsalthaj committed Dec 2, 2024
1 parent c2ea97d commit ec7a3f9
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
8 changes: 3 additions & 5 deletions golem-rib/src/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1175,12 +1175,10 @@ impl TryFrom<golem_api_grpc::proto::golem::rib::Expr> for Expr {
let type_name = number.type_name.map(TypeName::try_from).transpose()?;
let big_decimal = if let Some(number) = number.number {
BigDecimal::from_str(&number).map_err(|e| e.to_string())?
} else if let Some(float) = number.float {
BigDecimal::from_f64(float).ok_or("Invalid float")?
} else {
if let Some(float) = number.float {
BigDecimal::from_f64(float).ok_or("Invalid float")?
} else {
return Err("Missing number".to_string());
}
return Err("Missing number".to_string());
};

if let Some(type_name) = type_name {
Expand Down
2 changes: 1 addition & 1 deletion golem-rib/src/parser/number.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ mod tests {
assert_eq!(
result,
Ok((
Expr::untyped_number(BigDecimal::from_str("123.456f64").unwrap()),
Expr::untyped_number(BigDecimal::from_str("123.456").unwrap()),
""
))
);
Expand Down
2 changes: 1 addition & 1 deletion golem-rib/src/text/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ mod match_tests {
);

let expr_str = to_string(&input_expr).unwrap();
let expected_str = "match request { ok(foo) => 1 > 2, err(msg) => 1 < 2 } ".to_string();
let expected_str = "match request { ok(foo) => 1.1 > 2, err(msg) => 1 < 2 } ".to_string();
let output_expr = from_string(expr_str.as_str()).unwrap();
assert_eq!((expr_str, input_expr), (expected_str, output_expr));
}
Expand Down

0 comments on commit ec7a3f9

Please sign in to comment.