mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-08 02:31:18 -03:00
printf: Explain what couldn't be converted
This commit is contained in:
@@ -262,7 +262,7 @@ void builtin_printf_state_t::verify_numeric(const wchar_t *s, const wchar_t *end
|
|||||||
this->fatal_error(_(L"%ls: expected a numeric value"), s);
|
this->fatal_error(_(L"%ls: expected a numeric value"), s);
|
||||||
} else {
|
} else {
|
||||||
// This isn't entirely fatal - the value should still be printed.
|
// This isn't entirely fatal - the value should still be printed.
|
||||||
this->nonfatal_error(_(L"%ls: value not completely converted"), s);
|
this->nonfatal_error(_(L"%ls: value not completely converted (can't convert '%ls')"), s, end);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ printf '%e\n' "1.23" # should succeed, output should be 1.230000e+00
|
|||||||
|
|
||||||
printf '%e\n' "2,34" # should fail
|
printf '%e\n' "2,34" # should fail
|
||||||
# CHECK: 2.000000e+00
|
# CHECK: 2.000000e+00
|
||||||
# CHECKERR: 2,34: value not completely converted
|
# CHECKERR: 2,34: value not completely converted (can't convert ',34')
|
||||||
|
|
||||||
# Verify long long ints are handled correctly. See issue #3352.
|
# Verify long long ints are handled correctly. See issue #3352.
|
||||||
printf 'long hex1 %x\n' 498216206234
|
printf 'long hex1 %x\n' 498216206234
|
||||||
@@ -92,6 +92,6 @@ echo $status
|
|||||||
# Verify numeric conversion still happens even if it couldn't be fully converted
|
# Verify numeric conversion still happens even if it couldn't be fully converted
|
||||||
printf '%d\n' 15.1
|
printf '%d\n' 15.1
|
||||||
# CHECK: 15
|
# CHECK: 15
|
||||||
# CHECKERR: 15.1: value not completely converted
|
# CHECKERR: 15.1: value not completely converted (can't convert '.1')
|
||||||
echo $status
|
echo $status
|
||||||
# CHECK: 1
|
# CHECK: 1
|
||||||
|
|||||||
Reference in New Issue
Block a user