From 079ffa362fbec884c6397581c5f9898c4aba392e Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 13 Jun 2013 21:46:17 -0700 Subject: [PATCH] Correctly parse commands for rusti Closes #7120 --- src/librusti/rusti.rc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/librusti/rusti.rc b/src/librusti/rusti.rc index 90a5a350b7fa..7d221ce37889 100644 --- a/src/librusti/rusti.rc +++ b/src/librusti/rusti.rc @@ -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(); @@ -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); + } }