Ticket #1118 (closed enhancement: fixed)

Opened 7 years ago

Last modified 5 years ago

UTF to support checking strings that span multiple lines

Reported by: leonwlaw Owned by: leonwlaw
Priority: major Milestone:
Component: test module Version: 0.1t
Severity: Medium Keywords:
Cc: justinc Blocking:
Blocked By:


The strings that you tell UTF to check for can only be one line long. They cannot span multiple lines. For example, for the next code block, you cannot test for the entire string. You can only test for specific segments of the code, e.g. 'hello world' or 'this is a test message'. The newline character cannot be represented in the command used to indicate the test message.

# These work:
#pragma out hello world
# -- OR --
#pragma out this is a test message

# This will fail
#pragma out hello world\nthis is a test message

# Test case:
print "hello world"
print "this is a test message"

Change History

Changed 7 years ago by leonwlaw

  • owner set to leonwlaw
  • status changed from new to assigned
  • component changed from - to test module
  • type changed from defect to enhancement

Changed 7 years ago by justinc

Do you think maybe we should just check to see that every line of output is matched by some string?

How should this work?

Changed 7 years ago by leonwlaw

If I understand correctly, you want to be able to define a few expected strings, and as we check the program output, check off the expected strings one by one, until all the expected strings are accounted for? I think that could work equally as well, if not being more intuitive. I would enforce the order of occurrence for these strings just as preventive measure for potential bug masking. At one point I wrote a unit test and I expected this behavior.

Perhaps something like this, then?

#pragma out Hello world
print "Hello world"

#pragma out we need a test
#pragma out really badly
print "we need a test"

# Miscellaneous code that doesn't print stuff

print "really badly"

Changed 7 years ago by justinc

Sounds good to me. I agree it is more intuitive this way.

Changed 7 years ago by leonwlaw

  • status changed from assigned to closed
  • resolution set to fixed

These tests don't pass on either version:

  • ut_seattlelibtests_teststruct.py
  • ut_repytests_testnetbothdup.py
  • ut_repytests_testnetconndup.py
  • ut_repytests_testrecvmessfunctions.py
  • ut_repytests_testwaitforconnfunctions.py
  • ut_seattlelibtests_testgeoip_client.py
  • ut_seattlelibtests_testopenDHTadvertise.py

These tests did not finish running in a timely manner, on both versions:

  • ut_repytests_testnetmessdup.py
  • ut_repytests_testcleanup.py
  • ut_repytests_testcleanupudp.py
  • ut_repytests_testloopbind.py
  • ut_repynetworktests_multiple_iface_trybind.py
  • ut_seattlelibtests_testhttpserver.py
  • ut_seattlelibtests_testparallelize.py
  • ut_seattlelibtests_testpyDes.py
  • ut_seattlelibtests_testrsa.py
  • ut_seattlelibtests_testsshkey.py
  • ut_seattlelibtests_testxmlrpc.py

Aside from that, all other tests pass and are compatible with the new multi-line support.

Changed 5 years ago by leonwlaw

Just a note, this is fixed with r6029.

Note: See TracTickets for help on using tickets.