|
home—lects—hws
D2L—breeze (snow day)
As in hw01, you'll have three files:
This time, your tests should be (mostly) silent on success, and only print output when a test fails, such as utils-test-v2-php.txt. A successful test can print nothing, or perhaps some small progress-indication like “.”.
secret agenda: I'm hoping that typing all the tests is so verbose, that you get fed up and automated it by writing your own function — something liketest( $actual, $expected ) .
This time, silly-page.php should be mostly not enclosed in
Notes:
Note that this is just a regular ol' function that takes in strings and returns strings!
The fact that the strings happen to have angle-brackets in them means that the result might
be useful to people generating html, but the function itself does't really care.
(You don't need to come up with additional test cases, but you do need to actually include these tests or their equivalent. You can assume that neither string is ever empty.)
Note how the input strings don't contain any quote-characters, but the returned result does (since HTML attributes must be quoted). I recommend that your generated html uses single quote marks around attributes, but you'll get full credit for either single- or double-quote marks, as long as it is valid HTML. Make sure your test case(s) express exactly what you want the desired output should be!
Make a test-case for
You don't need further test-cases for this problem.
Pay close attention to the exact spacing you want to have.
I recommend using single-quotes (
For full credit, your function should call
home—lects—hws
D2L—breeze (snow day)
©2014, Ian Barland, Radford University Last modified 2014.Feb.01 (Sat) |
Please mail any suggestions (incl. typos, broken links) to ibarlandradford.edu |