diff options
| author | Graydon Hoare <[email protected]> | 2010-06-23 21:03:09 -0700 |
|---|---|---|
| committer | Graydon Hoare <[email protected]> | 2010-06-23 21:03:09 -0700 |
| commit | d6b7c96c3eb29b9244ece0c046d3f372ff432d04 (patch) | |
| tree | b425187e232966063ffc2f0d14c04a55d8f004ef /src/test/run-pass/basic.rs | |
| parent | Initial git commit. (diff) | |
| download | rust-d6b7c96c3eb29b9244ece0c046d3f372ff432d04.tar.xz rust-d6b7c96c3eb29b9244ece0c046d3f372ff432d04.zip | |
Populate tree.
Diffstat (limited to 'src/test/run-pass/basic.rs')
| -rw-r--r-- | src/test/run-pass/basic.rs | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/src/test/run-pass/basic.rs b/src/test/run-pass/basic.rs new file mode 100644 index 00000000..95e4bff8 --- /dev/null +++ b/src/test/run-pass/basic.rs @@ -0,0 +1,50 @@ +// -*- rust -*- + +io fn a(chan[int] c) { + if (true) { + log "task a"; + log "task a"; + log "task a"; + log "task a"; + log "task a"; + } + c <| 10; +} + +fn k(int x) -> int { + ret 15; +} + +fn g(int x, str y) -> int { + log x; + log y; + let int z = k(1); + ret z; +} + +io fn main() { + let int n = 2 + 3 * 7; + let str s = "hello there"; + let port[int] p = port(); + spawn a(chan(p)); + spawn b(chan(p)); + let int x = 10; + x = g(n,s); + log x; + n <- p; + n <- p; + // FIXME: use signal-channel for this. + log "children finished, root finishing"; +} + +io fn b(chan[int] c) { + if (true) { + log "task b"; + log "task b"; + log "task b"; + log "task b"; + log "task b"; + log "task b"; + } + c <| 10; +} |