|
From: <cr...@us...> - 2009-05-27 14:29:43
|
Revision: 5528
http://jnode.svn.sourceforge.net/jnode/?rev=5528&view=rev
Author: crawley
Date: 2009-05-27 14:29:36 +0000 (Wed, 27 May 2009)
Log Message:
-----------
Another bjorne completion bug.
Modified Paths:
--------------
trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneCompleter.java
trunk/shell/src/test/org/jnode/test/shell/bjorne/BjorneCompletionTests.java
Modified: trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneCompleter.java
===================================================================
--- trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneCompleter.java 2009-05-27 13:09:32 UTC (rev 5527)
+++ trunk/shell/src/shell/org/jnode/shell/bjorne/BjorneCompleter.java 2009-05-27 14:29:36 UTC (rev 5528)
@@ -35,8 +35,12 @@
public void complete(CompletionInfo completion, CommandShell shell) throws CompletionException {
Logger.getLogger(BjorneCompleter.class).debug(toString());
if (endToken == null) {
- new CommandLine(null, null).complete(completion, shell);
- return;
+ if (penultimateToken == null) {
+ new CommandLine(null, null).complete(completion, shell);
+ return;
+ }
+ endToken = penultimateToken;
+ endExpectedSet = penultimateExpectedSet;
}
if (command != null) {
BjorneToken[] words = command.getWords();
Modified: trunk/shell/src/test/org/jnode/test/shell/bjorne/BjorneCompletionTests.java
===================================================================
--- trunk/shell/src/test/org/jnode/test/shell/bjorne/BjorneCompletionTests.java 2009-05-27 13:09:32 UTC (rev 5527)
+++ trunk/shell/src/test/org/jnode/test/shell/bjorne/BjorneCompletionTests.java 2009-05-27 14:29:36 UTC (rev 5528)
@@ -114,6 +114,18 @@
doCompletionTest("if cpuid\nthen echo hi ; fi", "TTTTETT");
}
+ public void testIf3Command() throws ShellSyntaxException, CompletionException {
+ doCompletionTest("if cpuid ; then\necho hi ; fi", "TTTTTETT");
+ }
+
+ public void testIf4Command() throws ShellSyntaxException, CompletionException {
+ doCompletionTest("if cpuid ; then\necho hi\nfi", "TTTTTET");
+ }
+
+ public void testWhileCommand() throws ShellSyntaxException, CompletionException {
+ doCompletionTest("while cpuid ; do echo hi ; done", "TTTTTETT");
+ }
+
private void doCompletionTest(String input, String flags)
throws ShellSyntaxException, CompletionException {
BjorneInterpreter interpreter = new BjorneInterpreter();
@@ -152,7 +164,9 @@
// Maybe completions, maybe not
}
for (String completionWord : completionWords) {
- assertTrue(completionWord.startsWith(lastWord));
+ if (!completionWord.startsWith(lastWord)) {
+ fail("completion(s) don't start with '" + lastWord + "': " + diag(partial, completions));
+ }
}
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|