wallcito / google-toolbox-for-mac

Automatically exported from code.google.com/p/google-toolbox-for-mac
Apache License 2.0
0 stars 0 forks source link

STAssertEqualStrings message garbled when compared strings contain % signs (interpreted as printf-params) #8

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

1. Write code like this in an iPhone unit test:

- (void)testStrings
{
    NSString* s = @"mailto:test@example.com?subject=Hello%20World";
    STAssertEqualStrings( @"Something else", s, nil );
}

2. The error log from the test run contains gibberish in place of the URL
escape sequence. Presumably this is because %20W has been interpreted as a
printf-style substitution parameter; the escape sequence %2f yields a
floating point gibberish number, for example. 

/Users/ryan/projects/lib-iphone/UnitTests/IFMailMessageTest.m:15: error:
failure in raise (@"Something else") == (s)
(/Users/ryan/projects/lib-iphone/UnitTests/IFMailMessageTest.m:15: error:
Something else != mailto:test@example.com?subject=Hello2orld : ) : 

What is the expected output? What do you see instead?

I see "Hello2orld" instead of "Hello%20World".

What version of the product are you using? On what operating system?

1.5.1 on Mac OS X 10.5.5

Please provide any additional information below.

Original issue reported on code.google.com by ryandjoh...@gmail.com on 5 Dec 2008 at 7:10

GoogleCodeExporter commented 9 years ago
To be absolutely clear, the assert still works properly, it's just that the 
message
is garbled, making it terrifyingly difficult to figure out what has gone wrong 
when a
test fails.

Original comment by ryandjoh...@gmail.com on 5 Dec 2008 at 7:31

GoogleCodeExporter commented 9 years ago
Didn't mean to ignore this.  I've noticed this potential before, and the 
headers for
SenTest apple ships seem to imply the same issue.  Maybe I can come up w/ a way 
to
avoid it.

Original comment by thoma...@gmail.com on 6 Dec 2008 at 5:41

GoogleCodeExporter commented 9 years ago
Actually, what I thought you were referring to you don't appear to be.  What 
version
of GTM are you using?  If you use the trunk, I don't get this behavior.  A 
while ago
we change the output of the iphone testing, and that removed the problem you're
talking about.  My guess is you're using the zip?  We don't push those very 
often
because we figure most developers use svn:external to pull the code directly 
into
their trees.

Anyway, do you still see the issue w/ the trunk code?

Original comment by thoma...@gmail.com on 8 Dec 2008 at 4:15

GoogleCodeExporter commented 9 years ago
I'm still seeing this at R70. The original test case given in my bug report 
still fails.

Original comment by ryandjoh...@gmail.com on 8 Dec 2008 at 4:40

GoogleCodeExporter commented 9 years ago
Which SDK are you using?  Using the 2.0 Simulator, i just get this:

myTest.m:10: error: -[MyTest testStrings] : 'Something else' should be equal to
'mailto:test@example.com?subject=Hello%20World'. 

Original comment by thoma...@gmail.com on 8 Dec 2008 at 1:55

GoogleCodeExporter commented 9 years ago
Sorry, Thomas, I must have had a dirty build directory.

I built with -sdk iphonesimulator2.2, it worked there and when I went back to 
-sdk
iphonesimulator2.0 it is still working.

Next time I'll `rm -rf build` after upgrading GTM. 

Thanks for the help!

Original comment by ryandjoh...@gmail.com on 8 Dec 2008 at 5:12

GoogleCodeExporter commented 9 years ago
np.

closing this since it was fixed w/ the trunk bits.

Original comment by thoma...@gmail.com on 8 Dec 2008 at 9:35