aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorBrian Anderson <[email protected]>2011-03-21 22:25:34 -0400
committerGraydon Hoare <[email protected]>2011-03-22 08:04:51 -0700
commit0bcf49305cf34d6894c94b2eb8efcb3c022ffc0d (patch)
tree4abd7f025ceea96ef700bcf467b91bf1806a0aa4 /src/test
parentRemove a todo from trans_chan that doesn't appear necessary (diff)
downloadrust-0bcf49305cf34d6894c94b2eb8efcb3c022ffc0d.tar.xz
rust-0bcf49305cf34d6894c94b2eb8efcb3c022ffc0d.zip
Add test for sending strings over channels
Diffstat (limited to 'src/test')
-rw-r--r--src/test/run-pass/task-comm-16.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/test/run-pass/task-comm-16.rs b/src/test/run-pass/task-comm-16.rs
index 0b568cbc..a4944410 100644
--- a/src/test/run-pass/task-comm-16.rs
+++ b/src/test/run-pass/task-comm-16.rs
@@ -34,6 +34,22 @@ impure fn test_vec() {
check (v1.(2) == 2);
}
+impure fn test_str() {
+ let port[str] po = port();
+ let chan[str] ch = chan(po);
+ let str s0 = "test";
+
+ ch <| s0;
+
+ let str s1;
+ s1 <- po;
+
+ check (s1.(0) as u8 == 't' as u8);
+ check (s1.(1) as u8 == 'e' as u8);
+ check (s1.(2) as u8 == 's' as u8);
+ check (s1.(3) as u8 == 't' as u8);
+}
+
impure fn test_tup() {
type t = tup(int, u8, char);
@@ -99,6 +115,7 @@ impure fn test_chan() {
impure fn main() {
test_rec();
test_vec();
+ test_str();
test_tup();
test_tag();
test_chan();