mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-18 17:14:20 +01:00
core/printf: support for the %i operand
This commit is contained in:
@@ -28,7 +28,7 @@ pub fn exec_printf(values: &[Register]) -> crate::Result<Value> {
|
||||
result.push('%');
|
||||
continue;
|
||||
}
|
||||
Some('d') => {
|
||||
Some('d') | Some('i') => {
|
||||
if args_index >= values.len() {
|
||||
return Err(LimboError::InvalidArgument("not enough arguments".into()));
|
||||
}
|
||||
@@ -152,6 +152,7 @@ mod tests {
|
||||
vec![text("Number: %d"), text("not a number")],
|
||||
text("Number: 0"),
|
||||
),
|
||||
(vec![text("Number: %i"), integer(42)], text("Number: 42")),
|
||||
];
|
||||
for (input, output) in test_cases {
|
||||
assert_eq!(exec_printf(&input).unwrap(), *output.get_owned_value())
|
||||
|
||||
Reference in New Issue
Block a user