This is the mail archive of the frysk@sourceware.org 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]

Easier HPD expect methods


FYI,

For code wanting to test HPD interactions (as found in frysk.hpd.Test*) I've added the class frysk.hpd.HpdTestbed which extends Expect. This class both creates an instance of the HPD wrapped up in Expect and provides easier / more friendly expect methods vis:

-> they detect wrong-output+PROMPT; no longer is there a 5 second timeout before things fail
-> the failure message includes what was expected and what was in the buffer - easier to debug


For instance:

   public void testUnattached() {
       e = new HpdTestbed();
       // Add with no process; shouldn't crash.
       e.sendCommandExpectPrompt("print 2+2", "5\r\n");
   }

$ ./TestRunner frysk.hpd.TestPrint.testUnattached
Running testUnattached(frysk.hpd.TestPrint) ...FAIL
 junit.framework.AssertionFailedError: sent: <print 2+2> expecting: <5
> got: <print 2+2
4
(fhpd) >


Note that this class isn't intended for testing HPD invocation, or option parser (as done by the tests in frysk.bindir.TestHpd); as some point this class is going to get changed to run HPD as a thread in TestRunner.


Andrew


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