Skip to content

Commit

Permalink
Correctly parse commands for rusti
Browse files Browse the repository at this point in the history
Closes #7120
  • Loading branch information
alexcrichton committed Jun 14, 2013
1 parent 14ca129 commit d5d38cd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/librusti/rusti.rc
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ pub fn run_line(repl: &mut Repl, in: @io::Reader, out: @io::Writer, line: ~str,
use std::iterator::IteratorUtil;

// drop the : and the \n (one byte each)
let full = line.slice(1, line.len() - 1);
let full = line.slice(1, line.len());
let split: ~[~str] = full.word_iter().transform(|s| s.to_owned()).collect();
let len = split.len();

Expand Down Expand Up @@ -649,4 +649,14 @@ mod tests {
f()
");
}

#[test]
fn exit_quits() {
let mut r = repl();
assert!(r.running);
let result = run_line(&mut r, io::stdin(), io::stdout(),
~":exit", false);
assert!(result.is_none());
assert!(!r.running);
}
}

0 comments on commit d5d38cd

Please sign in to comment.