Start counter on ls with 1 and fix the tests.
This commit is contained in:
+3
-3
@@ -80,7 +80,7 @@ impl<'a> LKEval<'a> {
|
|||||||
tmp.push(name.borrow().to_string());
|
tmp.push(name.borrow().to_string());
|
||||||
}
|
}
|
||||||
tmp.sort();
|
tmp.sort();
|
||||||
let mut counter = 0;
|
let mut counter = 1;
|
||||||
for line in tmp {
|
for line in tmp {
|
||||||
out.push(format!("{:>3} {}", Radix::new(counter, 36).unwrap().to_string(), line));
|
out.push(format!("{:>3} {}", Radix::new(counter, 36).unwrap().to_string(), line));
|
||||||
counter += 1;
|
counter += 1;
|
||||||
@@ -190,7 +190,7 @@ mod tests {
|
|||||||
db.insert(pwd1.borrow().name.clone(), pwd1.clone());
|
db.insert(pwd1.borrow().name.clone(), pwd1.clone());
|
||||||
db
|
db
|
||||||
});
|
});
|
||||||
assert_eq!(LKEval::new(Command::Ls, lk.clone()).eval(), LKPrint::new(vec!["t1 R 99 2022-12-30 comment".to_string()], false, lk.clone()));
|
assert_eq!(LKEval::new(Command::Ls, lk.clone()).eval(), LKPrint::new(vec![" 1 t1 R 99 2022-12-30 comment".to_string()], false, lk.clone()));
|
||||||
assert_eq!(LKEval::new(Command::Quit, lk.clone()).eval(), LKPrint::new(vec!["Bye!".to_string()], true, lk.clone()));
|
assert_eq!(LKEval::new(Command::Quit, lk.clone()).eval(), LKPrint::new(vec!["Bye!".to_string()], true, lk.clone()));
|
||||||
let pwd2 = Rc::new(RefCell::new(Password {
|
let pwd2 = Rc::new(RefCell::new(Password {
|
||||||
name: Rc::new("t2".to_string()),
|
name: Rc::new("t2".to_string()),
|
||||||
@@ -210,7 +210,7 @@ mod tests {
|
|||||||
});
|
});
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
LKEval::new(Command::Ls, lk.clone()).eval(),
|
LKEval::new(Command::Ls, lk.clone()).eval(),
|
||||||
LKPrint::new(vec!["t1 R 99 2022-12-30 comment".to_string(), "t2 R 99 2022-12-31 bli blup".to_string()], false, lk.clone())
|
LKPrint::new(vec![" 1 t1 R 99 2022-12-30 comment".to_string(), " 2 t2 R 99 2022-12-31 bli blup".to_string()], false, lk.clone())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user