public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
* Easier HPD expect methods
@ 2007-09-06 13:40 Andrew Cagney
  0 siblings, 0 replies; only message in thread
From: Andrew Cagney @ 2007-09-06 13:40 UTC (permalink / raw)
  To: frysk

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-09-06 13:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-06 13:40 Easier HPD expect methods Andrew Cagney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).