This is the mail archive of the frysk-cvs@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SCM] master: Eliminate CommandHelp.


The branch, master has been updated
       via  b3adba000519e004a2de1f4094fa7628c17fe3cf (commit)
       via  47742cfcab2ab02dc1e2e4aca649974036690a9f (commit)
      from  5322772f56b85e995df7bf5b6833ea1230f2492e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit b3adba000519e004a2de1f4094fa7628c17fe3cf
Author: Andrew Cagney <cagney@redhat.com>
Date:   Sat Nov 17 21:52:19 2007 -0500

    Eliminate CommandHelp.
    
    frysk-core/frysk/hpd/ChangeLog
    2007-11-17  Andrew Cagney  <cagney@redhat.com>
    
    	* CommandHelp.java: Delete.
    	* Command.java (getHelp()): Delete.
    	(help): Delete.

commit 47742cfcab2ab02dc1e2e4aca649974036690a9f
Author: Andrew Cagney <cagney@redhat.com>
Date:   Sat Nov 17 21:40:07 2007 -0500

    Check all top-level commands exist.
    
    frysk-core/frysk/hpd/ChangeLog
    2007-11-17  Andrew Cagney  <cagney@redhat.com>
    
    	* TestHelp.java (topLevel): New.
    	(testHelp()): Use.
    	(testBlankCompletion()): New.
    	(setUp()): New.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/hpd/ChangeLog        |    9 +++
 frysk-core/frysk/hpd/Command.java     |   18 +++---
 frysk-core/frysk/hpd/CommandHelp.java |   81 ------------------------------
 frysk-core/frysk/hpd/TestHelp.java    |   87 +++++++++++++++++++++++++++-----
 4 files changed, 91 insertions(+), 104 deletions(-)
 delete mode 100644 frysk-core/frysk/hpd/CommandHelp.java

First 500 lines of diff:
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index a2532f0..e5dd9e4 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -1,5 +1,14 @@
 2007-11-17  Andrew Cagney  <cagney@redhat.com>
 
+	* CommandHelp.java: Delete.
+	* Command.java (getHelp()): Delete.
+	(help): Delete.
+	
+	* TestHelp.java (topLevel): New.
+	(testHelp()): Use.
+	(testBlankCompletion()): New.
+	(setUp()): New.
+
 	* CLI.java (parseValue(Task,String,boolean)): Delete.
 	(parseValue(Task,String)): Delete.
 	(parseExpression(Task,String)): New.
diff --git a/frysk-core/frysk/hpd/Command.java b/frysk-core/frysk/hpd/Command.java
index aa55f78..2a09e55 100644
--- a/frysk-core/frysk/hpd/Command.java
+++ b/frysk-core/frysk/hpd/Command.java
@@ -46,12 +46,10 @@ import java.util.List;
  */
 
 public abstract class Command {
-    private final CommandHelp help;
     private final String name;  
-
-    public CommandHelp getHelp() {
-	return help;
-    }
+    private final String description;
+    private final String syntax;
+    private final String full;
 
     public String getName() {
 	return name;
@@ -59,7 +57,9 @@ public abstract class Command {
   
     Command (String name, String description, String syntax, String full) {
 	this.name = name;
-	this.help = new CommandHelp(name, description, syntax, full);
+	this.description = description;
+	this.syntax = syntax;
+	this.full = full;
     }
   
     public abstract void interpret(CLI cli, Input cmd);
@@ -79,9 +79,9 @@ public abstract class Command {
      */
     void help(CLI cli, Input buffer) {
 	cli.outWriter.print("Usage: ");
-	cli.outWriter.print(help.getSyntax());
+	cli.outWriter.print(syntax);
 	cli.outWriter.println();
-	cli.outWriter.print(help.getFull());
+	cli.outWriter.print(full);
 	cli.outWriter.println();
     }
 
@@ -89,6 +89,6 @@ public abstract class Command {
      * Return a brief (one line) description of the command.
      */
     String description() {
-	return help.getDescription();
+	return description;
     }
 }
diff --git a/frysk-core/frysk/hpd/CommandHelp.java b/frysk-core/frysk/hpd/CommandHelp.java
deleted file mode 100644
index 8aff9ea..0000000
--- a/frysk-core/frysk/hpd/CommandHelp.java
+++ /dev/null
@@ -1,81 +0,0 @@
-// This file is part of the program FRYSK.
-//
-// Copyright 2006, 2007 Red Hat Inc.
-//
-// FRYSK is free software; you can redistribute it and/or modify it
-// under the terms of the GNU General Public License as published by
-// the Free Software Foundation; version 2 of the License.
-//
-// FRYSK is distributed in the hope that it will be useful, but
-// WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Public License for more details.
-// 
-// You should have received a copy of the GNU General Public License
-// along with FRYSK; if not, write to the Free Software Foundation,
-// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
-// 
-// In addition, as a special exception, Red Hat, Inc. gives You the
-// additional right to link the code of FRYSK with code not covered
-// under the GNU General Public License ("Non-GPL Code") and to
-// distribute linked combinations including the two, subject to the
-// limitations in this paragraph. Non-GPL Code permitted under this
-// exception must only link to the code of FRYSK through those well
-// defined interfaces identified in the file named EXCEPTION found in
-// the source code files (the "Approved Interfaces"). The files of
-// Non-GPL Code may instantiate templates or use macros or inline
-// functions from the Approved Interfaces without causing the
-// resulting work to be covered by the GNU General Public
-// License. Only Red Hat, Inc. may make changes or additions to the
-// list of Approved Interfaces. You must obey the GNU General Public
-// License in all respects for all of the FRYSK code and other code
-// used in conjunction with FRYSK except the Non-GPL Code covered by
-// this exception. If you modify this file, you may extend this
-// exception to your version of the file, but you are not obligated to
-// do so. If you do not wish to provide this exception without
-// modification, you must delete this exception statement from your
-// version and license this file solely under the GPL without
-// exception.
-package frysk.hpd;
-
-class CommandHelp
-{
-  String cmd;
-  String descr;
-  String syntax;
-  String full;
-
-  CommandHelp(String cmd, String descr, String syntax, String full)
-  {
-    this.cmd = cmd;
-    this.descr = descr;
-    this.syntax = syntax;
-    this.full = full;
-  }
-
-  String getCommand()
-  {
-    return cmd;
-  }
-		
-  String getDescription()
-  {
-    return descr;
-  }
-
-  String getSyntax()
-  {
-    return syntax;
-  }
-
-  String getFull()
-  {
-    return full;
-  }
-  
-  public String toPrint()
-  {
-      return cmd + ": " + descr + "\n" + syntax + "\n" + full + "\n";
-  }
-}
-	
diff --git a/frysk-core/frysk/hpd/TestHelp.java b/frysk-core/frysk/hpd/TestHelp.java
index 2fbca4e..5a1c465 100644
--- a/frysk-core/frysk/hpd/TestHelp.java
+++ b/frysk-core/frysk/hpd/TestHelp.java
@@ -46,29 +46,88 @@ package frysk.hpd;
 public class TestHelp
     extends TestLib
 {
-    public void testHelp() {
+    // A list of the top-level commands; this needs updating when ever
+    // a new top-level command is added or (more importantly not
+    // accidently) removed.
+    private final String[] topLevel = {
+	"actions",
+	"alias",
+	"assign",
+	"attach",
+	"break",
+	"core",
+	"debuginfo",
+	"defset",
+	"delete",
+	"detach",
+	"disable",
+	"disassemble",
+	"display",
+	"down",
+	"enable",
+	"examine",
+	"exit",
+	"finish",
+	"focus",
+	"frame",
+	"go",
+	"halt",
+	"help",
+	"list",
+	"load",
+	"next",
+	"nexti",
+	"peek",
+	"plocation",
+	"print",
+	"ptype",
+	"quit",
+	"regs",
+	"run",
+	"set",
+	"step",
+	"stepi",
+	"unalias",
+	"undefset",
+	"unset",
+	"up",
+	"viewset",
+	"what",
+	"where",
+	"whichsets",
+    };
+
+    public void setUp() {
+	super.setUp();
 	e = new HpdTestbed();
+    }
+
+    public void testBlankCompletion() {
+	e.send("\t");
+	for (int i = 0; i < topLevel.length; i++) {
+	    e.expect(topLevel[i] + "\\r\\n");
+	}
+	e.expect(prompt);
+    }
+
+    public void testHelp() {
 	e.send("help\n");
-	e.expect("actions - ");
-	e.expect("core - ");
-	e.expect("finish - ");
-	e.expect("list - ");
-	e.expect("peek - ");
-	e.expect("regs - ");
-	e.expect("step - ");
-	e.expect("up - ");
-	e.expectPrompt("whichsets.*");
+	for (int i = 0; i < topLevel.length; i++) {
+	    e.expect(topLevel[i] + " - [^\\r\\n]*\\r\\n");
+	}
+	e.expectPrompt("");
     }
 
     public void testHelpCompletion() {
-	e = new HpdTestbed();
 	e.send("help u\t");
-	e.expect("unalias\r\nundefset\r\nunset\r\nup\r\n"
-		 + prompt + "help u");
+	e.expect("unalias\\r\\n");
+	e.expect("undefset\\r\\n");
+	e.expect("unset\\r\\n");
+	e.expect("up\\r\\n");
+	e.expect(prompt + "help u");
     }
 
     public void testHelpHelp() {
-	e = new HpdTestbed();
 	e.sendCommandExpectPrompt("help help",
 				  "Display help.*");
     }


hooks/post-receive
--
frysk system monitor/debugger


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]