about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorBrian Anderson <andersrb@gmail.com>2011-01-07 21:25:51 -0500
committerGraydon Hoare <graydon@mozilla.com>2011-01-10 11:31:32 -0800
commit32c1c9f55c7a5575aa462bcec9e00cd11273841a (patch)
tree20cd785a9109d155fd2e8fbb89ba3ffb23c85bd4 /src
parentb5e62b04a060dea5e51f9bb65677ea8bd23dc971 (diff)
Simplify the test for circular_buffer initialization
Diffstat (limited to 'src')
-rw-r--r--src/test/run-pass/chan-poweroftwo.rs25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/test/run-pass/chan-poweroftwo.rs b/src/test/run-pass/chan-poweroftwo.rs
index ce2751fab9b..fc05d7cc047 100644
--- a/src/test/run-pass/chan-poweroftwo.rs
+++ b/src/test/run-pass/chan-poweroftwo.rs
@@ -1,6 +1,7 @@
 // -*- rust -*-
 
-// Regression test for circular_buffer initialization
+// Regression tests for circular_buffer when using a unit
+// that has a size that is not a power of two
 
 use std;
 
@@ -8,22 +9,24 @@ import std.option;
 import std._uint;
 import std._vec;
 
-// 12-byte unit for the channel buffer. Assuming that the default
-// buffer size needs to hold 8 units, then the minimum buffer size
-// needs to be 96. That's not a power of two so needs to be rounded up.
+// A 12-byte unit to send over the channel
 type record = rec(i32 val1, i32 val2, i32 val3);
 
-impure fn worker(chan[record] channel) {
+// Assuming that the default buffer size needs to hold 8 units,
+// then the minimum buffer size needs to be 96. That's not a
+// power of two so needs to be rounded up. Don't trigger any
+// assertions.
+impure fn test_init() {
+    let port[record] myport = port();
+    auto mychan = chan(myport);
+
     let record val = rec(val1=0i32, val2=0i32, val3=0i32);
-    channel <| val;
+
+    mychan <| val;
 }
 
 impure fn main() {
-    let port[record] myport = port();
-    auto mychan = chan(myport);
-
-    auto temp = spawn worker(mychan);
-    auto val <- myport;
+    test_init();
 }
 
 // Local Variables: