Skip to content
Snippets Groups Projects
Commit e717aa92 authored by Villsty's avatar Villsty
Browse files

almost finished

parent 64fe1ff2
Branches main
No related tags found
No related merge requests found
......@@ -11,26 +11,26 @@ import static org.junit.jupiter.api.Assertions.*;
public class TestSimpleShellEcho {
// @Test
// public void testEchoInSimpleShell() {
// SimpleShell shell = new SimpleShell();
// shell.installCommand(new CmdEcho());
//
// shell.keyPressed('e');
// shell.keyPressed('c');
// shell.keyPressed('h');
// shell.keyPressed('o');
// shell.keyPressed(' ');
// shell.keyPressed('f');
// shell.keyPressed('o');
// shell.keyPressed('o');
// shell.keyPressed(' ');
// shell.keyPressed('b');
// shell.keyPressed('a');
// shell.keyPressed('r');
// shell.keyPressed('\n');
//
// String expected = "$ echo foo bar\nfoo bar \n$ ";
// assertEquals(expected, shell.getScreenContent());
// }
@Test
public void testEchoInSimpleShell() {
SimpleShell shell = new SimpleShell();
shell.installCommand(new CmdEcho());
shell.keyPressed('e');
shell.keyPressed('c');
shell.keyPressed('h');
shell.keyPressed('o');
shell.keyPressed(' ');
shell.keyPressed('f');
shell.keyPressed('o');
shell.keyPressed('o');
shell.keyPressed(' ');
shell.keyPressed('b');
shell.keyPressed('a');
shell.keyPressed('r');
shell.keyPressed('\n');
String expected = "$ echo foo bar\nfoo bar \n$ ";
assertEquals(expected, shell.getScreenContent());
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment