about summary refs log tree commit diff
path: root/src/test
diff options
context:
space:
mode:
authorBrian Anderson <andersrb@gmail.com>2011-04-13 21:36:32 -0400
committerBrian Anderson <andersrb@gmail.com>2011-04-13 22:14:54 -0400
commit99a697b56abba8e4ab94fc14b5b4769bee9702f0 (patch)
treeae9b3e81e9fbfe294974a0034a35b57b96babf27 /src/test
parent5c0f4c1939b392e0bd0bcbce86fa83eb7a421992 (diff)
Add support for upper-case hex and binary output to #fmt.
Only works for uints at present. Necessitated the addition of _str.to_upper.
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/lib-str.rs11
-rw-r--r--src/test/run-pass/syntax-extension-fmt.rs2
2 files changed, 13 insertions, 0 deletions
diff --git a/src/test/run-pass/lib-str.rs b/src/test/run-pass/lib-str.rs
index 52f0f51b087..e1e4abb1638 100644
--- a/src/test/run-pass/lib-str.rs
+++ b/src/test/run-pass/lib-str.rs
@@ -89,6 +89,16 @@ fn test_connect() {
   t(vec("hi"), " ", "hi");
 }
 
+fn test_to_upper() {
+  // to_upper doesn't understand unicode yet,
+  // but we need to at least preserve it
+  auto unicode = "\u65e5\u672c";
+  auto input = "abcDEF" + unicode + "xyz:.;";
+  auto expected = "ABCDEF" + unicode + "XYZ:.;";
+  auto actual = _str.to_upper(input);
+  check (_str.eq(expected, actual));
+}
+
 
 fn main() {
   test_bytes_len();
@@ -98,4 +108,5 @@ fn main() {
   test_substr();
   test_concat();
   test_connect();
+  test_to_upper();
 }
diff --git a/src/test/run-pass/syntax-extension-fmt.rs b/src/test/run-pass/syntax-extension-fmt.rs
index 78a414b35b6..fcb0df183a5 100644
--- a/src/test/run-pass/syntax-extension-fmt.rs
+++ b/src/test/run-pass/syntax-extension-fmt.rs
@@ -23,4 +23,6 @@ fn main() {
   test(#fmt("%b", false), "false");
   test(#fmt("%c", 'A'), "A");
   test(#fmt("%x", 0xff_u), "ff");
+  test(#fmt("%X", 0x12ab_u), "12AB");
+  test(#fmt("%t", 0b11010101_u), "11010101");
 }