Skip to content

Commit b367b64

Browse files
committed
---
yaml --- r: 16243 b: refs/heads/try c: 2d0e7cd h: refs/heads/master i: 16241: fd4f596 16239: 79a7682 v: v3
1 parent 2083c47 commit b367b64

File tree

2 files changed

+23
-3
lines changed

2 files changed

+23
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
refs/heads/master: 61b1875c16de39c166b0f4d54bba19f9c6777d1a
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
5-
refs/heads/try: 6e0085210c54150f794d20791b2e9c1fda6049fc
5+
refs/heads/try: 2d0e7cd272136f12f8c07cafe57df408d37ada6f
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105

branches/try/src/libcore/uint-template.rs

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,9 +95,15 @@ fn from_str_radix(buf: str, radix: u64) -> option<u64> {
9595
};
9696
}
9797

98-
#[doc = "Convert to a string in a given base"]
98+
#[doc = "
99+
Convert to a string in a given base
100+
101+
# Failure
102+
103+
Fails if `radix` < 2 or `radix` > 16
104+
"]
99105
fn to_str(num: T, radix: uint) -> str {
100-
assert (0u < radix && radix <= 16u);
106+
assert (1u < radix && radix <= 16u);
101107
let mut n = num;
102108
let radix = radix as T;
103109
fn digit(n: T) -> u8 {
@@ -167,3 +173,17 @@ fn test_parse_buf() {
167173
assert parse_buf(str::bytes("Z"), 10u) == none;
168174
assert parse_buf(str::bytes("_"), 2u) == none;
169175
}
176+
177+
#[test]
178+
#[should_fail]
179+
#[ignore(cfg(target_os = "win32"))]
180+
fn to_str_radix1() {
181+
uint::to_str(100u, 1u);
182+
}
183+
184+
#[test]
185+
#[should_fail]
186+
#[ignore(cfg(target_os = "win32"))]
187+
fn to_str_radix17() {
188+
uint::to_str(100u, 17u);
189+
}

0 commit comments

Comments
 (0)