Some formatting and updated test. Updated releasenotes.

This commit is contained in:
Christoffer Lerno
2025-03-07 00:14:41 +01:00
parent c790ecbca5
commit 5482107ca8
3 changed files with 7 additions and 21 deletions

View File

@@ -465,7 +465,8 @@ macro String.to_real(chars, $Type) @private
while (chars.len && chars[0] == ' ') chars = chars[1..];
if (!chars.len) return NumberConversion.MALFORMED_FLOAT?;
if (chars.len != 1) {
if (chars.len != 1)
{
switch (chars[0])
{
case '-':

View File

@@ -30,6 +30,7 @@
- Aliases were incorrectly considered compile time constants.
- FreeBSD libc stat definitions were incorrect.
- Atomic max was incorrect.
- `"+".to_float()` would panic.
### Stdlib changes
- `new_*` functions in general moved to version without `new_` prefix.

View File

@@ -12,16 +12,8 @@ fn void test_float() @test
assert(String.to_float("-23.545")!! == -23.545f);
assert(String.to_float("1.5555555555555")!! == 1.5555555555555f);
assert(String.to_float("1.5555555555556666")!! == 1.5555555555556666f);
if (catch excuse = String.to_float("+")) {
assert(excuse == NumberConversion.MALFORMED_FLOAT);
} else {
assert(false);
}
if (catch excuse = String.to_float("-")) {
assert(excuse == NumberConversion.MALFORMED_FLOAT);
} else {
assert(false);
}
test::@error("+".to_float(), NumberConversion.MALFORMED_FLOAT);
test::@error("-".to_float(), NumberConversion.MALFORMED_FLOAT);
}
fn void test_double() @test
@@ -36,14 +28,6 @@ fn void test_double() @test
assert(String.to_double("-23.545")!! == -23.545);
assert(String.to_double("1.5555555555555")!! == 1.5555555555555);
assert(String.to_double("1.5555555555556666")!! == 1.5555555555556666);
if (catch excuse = String.to_double("+")) {
assert(excuse == NumberConversion.MALFORMED_FLOAT);
} else {
assert(false);
}
if (catch excuse = String.to_double("-")) {
assert(excuse == NumberConversion.MALFORMED_FLOAT);
} else {
assert(false);
}
test::@error("+".to_double(), NumberConversion.MALFORMED_FLOAT);
test::@error("-".to_double(), NumberConversion.MALFORMED_FLOAT);
}