- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
Frist! You say
As if that was a bad thing. Clearly you don't understand management's metrics for test performance. Management almost always gets wheat they ask for. Even if it isn't what they want or should want.
They want a test for each function and want that test to pass. All else is fluff outside your lane.
By that standard I call this a rousing success.
Admin
Nobody expects the Spanish 3
Admin
expect(WTF)
Admin
For 3 months I consulted at a major financial firm where 80% of the unit tests had no 'expect' at all. Management looked at a 'coverage' report number for the project, but didn't care if the coverage was real. The expect(3) is different, but the rest of this WTF looks very similar to that project.
Admin
Is this a testing library where expect(3) means "expect this test to contain 3 assertions"?
I've seen this once or twice in JavaScript for testing callbacks, where you want the test to fail if the callback with the assertion in it doesn't get called.
Admin
"New rule: all code must be submitted with passing tests" said the manager following the last deployment disaster.
Copy paste some random other previous test.
Done.
Admin
More likely it wants a truthy/falsey value, and explodes if the value is falsey.
3
is truthy, so everything is reported as just peachy.Admin
I like the words truthy and falsey. Although I think I'd probably spell the latter as falsy. Also I prefer the later to the former anyway. Truthy sounds too much like a sort of tooth. Where as falsy sounds like what you'd say to a small child when explaining why you lied. "What I said is only kind of falsy little Timmy."
Admin
truthy and falsy are official not just whimsical terms; they are official Javascript nomenclature https://developer.mozilla.org/en-US/docs/Glossary/Truthy
Admin
But you are not denying that they are in fact whimsical and more than a tad amusing.
Admin
Huh. I'm used to
expect(1)
rather thanexpect(3)
.Admin
Why does lispParser parse
b
as{"function": "b", "arguments": []}
? It's not a function call, that would be(a (b))
.Admin
It's Jasmine, or something like it, so "expect" creates an assertion subject that is supposed to be followed by an assertion predicate, but isn't.
This raises the question of why Jasmine doesn't track the subjects created in a case and verify that all of them had predicates. "People can just read the docs." That's a good one, tell me another.
Admin
You young punks! "Falsy" specifically refers to a woman's brassiere with a thick layer or two to artificially enhance apparent bosom size.
Admin
I thought that was a falsie...
Admin
Actually (a b) is a function call, corresponding to a(b) in C. (a (b)) would be a(b()).
Admin
So what you're saying is that they didn't break the build.
I see a great future.
Admin
That is why you should use the https://github.com/auchenberg/volkswagen library in your code :)
Admin
"So we start by expecting 3. Which, uh, usually the expect function starts a series of assertions, like we expect(returnValue).toBe(3). Here, we just expect three. Nothing about three, we just expect it." Ok I did not see this testing framework before so after reading this line, I started laughing like a maniac.
Admin
Except QUnit uses
expect(amount)
to specify how many assertions are expected in a test. It's usually used when testing asynchronous code, it's not so useful here, so it's still a WTF.