Skip to content

Commit 3ab738f

Browse files
committed
Add more #fmt float tests
1 parent a7359f5 commit 3ab738f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/test/run-pass/syntax-extension-fmt.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ fn main() {
2222
part5();
2323
part6();
2424
percent();
25+
more_floats();
2526
}
2627

2728
fn part1() {
@@ -240,3 +241,11 @@ fn percent() {
240241
let s = #fmt["ab%%cd"];
241242
assert(s == "ab%cd");
242243
}
244+
245+
fn more_floats() {
246+
assert "3.1416" == #fmt["%.4f", 3.14159];
247+
assert "3" == #fmt["%.0f", 3.14159];
248+
assert "99" == #fmt["%.0f", 98.5];
249+
assert "7.0000" == #fmt["%.4f", 6.999999999];
250+
assert "3.141590000" == #fmt["%.9f", 3.14159];
251+
}

0 commit comments

Comments
 (0)