SeattleTestbed / utf

Unit Test Framework for SeattleTestbed
MIT License
1 stars 9 forks source link

UTF to support checking strings that span multiple lines #38

Closed choksi81 closed 10 years ago

choksi81 commented 10 years ago

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"
choksi81 commented 10 years ago

Author: 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?

choksi81 commented 10 years ago

Author: 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"
choksi81 commented 10 years ago

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

choksi81 commented 10 years ago

Author: leonwlaw These tests don't pass on either version:

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

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

choksi81 commented 10 years ago

Author: leonwlaw Just a note, this is fixed with r6029.