rust/src/test/run-pass/match-drop-strs-issue-4541.rs
Alex Crichton 30862a64c2 Fix run-pass tests to have 'pub fn main'
This is required by the check-fast target because each test is slurped up into a
submodule.
2013-09-25 00:43:37 -07:00

28 lines
508 B
Rust

// Tests a tricky scenario involving string matching,
// copying, and moving to ensure that we don't segfault
// or double-free, as we were wont to do in the past.
use std::io;
use std::os;
fn parse_args() -> ~str {
let args = os::args();
let mut n = 0;
while n < args.len() {
match args[n].clone() {
~"-v" => (),
s => {
return s;
}
}
n += 1;
}
return ~""
}
pub fn main() {
io::println(parse_args());
}