Mochabot log - CommonJS IRC channel: #commonjs on irc.freenode.net

2009-11-06:

[19:20] <BryanWB> can anyone here recommend a good tutorial on unit testing and js? it is kicking my butt today learning tdd w/ js
[19:24] <basant> hey guys, just wondering.....in the spec....has eventing been considered... if so .... can anyone point me to the right place?
[19:26] <basant> umm helllooo
[19:27] <BryanWB> basant: dude, be patient
[19:27] <BryanWB> basant: and u r asking at the wrong time, jsconf is happening right now
[19:29] <basant> <--- total noob...sorry.... didnt read the entire spec yet
[19:29] <BryanWB> basant: have u tried the wiki yet?
[19:30] <basant> in the process
[19:30] <BryanWB> basant: you can also look thru the ML but I bet that if it isn't in the wiki then it hasn't been decided yet
[19:31] <BryanWB> actually, i m sure if it isn't in the wiki then it hasn't been decided yet
[19:31] <Wes--> basant: events not considered yet. Promises *might* interest you. What are you doing?
[19:32] <basant> doing as in with... work? or opensource projects?
[19:33] <Wes--> basant: as in events
[19:34] <BryanWB> Wes--, do u know much about TDD? i could really use some quick advice
[19:34] <kriszyp> here is what I am doing for events: http://github.com/kriszyp/pintura/blob/master/lib/listen.js
[19:34] <Wes--> BryanWB: If you mean those typing things for deaf people, I only know they work on 50bps BAUDOT
[19:35] <Wes--> which encodes data something like, but not the same as, RS232
[19:35] <BryanWB> Wes--: i mean test driven development ;)
[19:35] <Wes--> Oh, THAT. I'm probably not your guy.
[19:35] <BryanWB> ok
[19:36] <Wes--> BryanWB: never hurts to ask specific questions, though. Somebody may know the answer.
[19:36] <BryanWB> i am torn between making lots of small functions that I can test individually
[19:36] <BryanWB> or making large functions w/ lots of throw(error) statements, and testing that the right errors are thrown.
[19:37] <basant> Wes: i was thinking in the same direction as kriszyp
[19:38] <evilstreak> BryanWB: write small functions
[19:38] <evilstreak> test atomically
[19:39] <BryanWB> evilstreak: small functions in my code or small test functions?
[19:39] <BryanWB> s/my code/main code/
[19:39] <basant> Wes--: only one could add some rollback strategy or something
[19:39] <BryanWB> evilstreak: also, to test all my functions do I have to make them all public methods?
[19:40] <Wes--> basant: you should definitely read all the promises stuff in the archives then
[19:40] <evilstreak> you can't test stuff which is hidden inside a closure
[19:41] <Wes--> BryanWB: I tend to make small programs which execute a very small number of tests (usually 1)
[19:41] <BryanWB> evilstreak: so i have to make everything i want to test a public method
[19:41] <basant> Wes--: could u point me to the page?
[19:41] <Wes--> BryanWB: Then I loop over them with the shell
[19:41] <evilstreak> yup, 'fraid so
[19:41] <BryanWB> evilstreak: tks
[19:41] <Wes--> basant: commonjs google group
[19:41] <Wes--> I make error reporting the program's job, but usually I just throw uncaught exceptions; except when testing exceptions
[19:42] <Wes--> in which case I catch the ones I'm testing, and if they're not caught I throw
[19:42] <basant> Wes--:okk.. thanks.
[19:42] <BryanWB> basant: this group can take a while to agree to a spec , but a great thing about the group is that the participants implement agreed upon specs very quickly
[19:43] <basant> BryanWB: yeah true bryan... pretty damn surprised and happy to see the way this thing has caught on
[19:45] <BryanWB> evilstreak: so u think small functions is better than write large functions w/ throw(specific_error) at particular points of the function and checking that injecting a particular error returns the correct error type?
[19:54] <evilstreak> IMO functions should perform a single task
[19:54] <evilstreak> if your function is doing many different things, split off the responsibility to smaller functions
[19:55] <evilstreak> (of course, I often don't stick to that, so hey, pinch of salt etc.)
[19:56] <BryanWB> evilstreak: tks for the advice
[19:56] <Wes--> BryanWB: this is an ideally complex test IMHO: http://pastebin.mozilla.org/681737
[19:57] <Wes--> BryanWB: And this is about as much stuff as you should test at once: http://pastebin.mozilla.org/681739
[19:57] <Wes--> Note that these are both "smoke tests"
[19:57] <Wes--> which are the most important kind
[19:57] <BryanWB> Wes--: that is a lot of stuff to test at once
[19:58] <Wes--> BryanWB: Yes, I should have said "maximally complex test" - unfortunately, sometimes you need a bunch of bootstrapping to get to the nuggets
[19:59] <Wes--> BryanWB: the second test I posted is primarly to test function call return types having a method which emits strings from void pointers reasonably
[19:59] <BryanWB> i c
[23:56] <ashb> anyone seen the binary data thread on es-discuss?

 

 

Logs by date :