nadavc / groovykoans

A collection of small exercises in the form of unit tests, designed to get Java developers up to speed on Groovy
http://nadavc.github.com/groovykoans
Do What The F*ck You Want To Public License
264 stars 145 forks source link

01 works out of the box #4

Closed winkler1 closed 12 years ago

winkler1 commented 12 years ago

Hey- Not sure how to best contact you so trying this. First - awesome idea!

Issue - I downloaded the zip and did the first koan.

E:\downloads\nadavc-groovykoans-19dc5c1\nadavc-groovykoans-19dc5c1>gradlew koan01
Groovy Koans 0.1:
"When 900 years old, you reach, look as good, you will not." - Yoda

-------------------------------------------------------------------
Running exercises in test01_AssertionsAndSomeSyntax().......SUCCESS
Running exercises in test05_ElvisAndSafeNavigation()........SUCCESS
Running exercises in test04_Lists().........................SUCCESS
Running exercises in test02_GStrings()......................SUCCESS
Running exercises in test03_MapsInGroovy()..................SUCCESS
Koan is complete. Well done!

The code already has the answers in it!


On the asserts... why not just use groovy power asserts? They're more readable (IMO), and produce the nice power assert messages when they fail. You can always tack on your desired message as a 2nd param:

assertEquals('Modify "Hola" to "Hello" to proceed', "Hello", hello)

can just be

assert hello == "Hello", 'Modify "Hola" to "Hello" to proceed'

Why learn nasty old JUnit syntax if not necessary? :)

winkler1 commented 12 years ago

2-9 work too. Woohooh, I'm going home now :)

E:\downloads\nadavc-groovykoans-19dc5c1\nadavc-groovykoans-19dc5c1>gradlew koan09
Groovy Koans 0.1:
If I agreed with you we'd both be wrong.
----------------------------------------

Running exercises in test01_Expando().......................SUCCESS
Running exercises in test02_GroovyInterceptors()............SUCCESS
Running exercises in test03_ThisDelegateAndOwner()..........SUCCESS
Running exercises in test04_InvokeMethod()..................SUCCESS
Running exercises in test05_AddMethodsToExistingObjects()...SUCCESS
Koan is complete. Well done!
nadavc commented 12 years ago

@winkler1 did you run gradlew.bat removeSolutions before trying to solve the Koans? If you haven't already, please have a look at the instructions at https://github.com/nadavc/groovykoans#getting-started.

And regarding the power asserts - great idea! If you can spare the time, I'd really appreciate a pull request :)

winkler1 commented 12 years ago

Nope I didn't, The instructions never mentioned this. I'd assume it would not come out of the box with answers in place.

Will try to find some time to do that :)

On Tue, Sep 25, 2012 at 3:03 PM, nadavc notifications@github.com wrote:

@winkler1 https://github.com/winkler1 did you run gradlew.bat removeSolutions before trying to solve the Koans? If you haven't already, please have a look at the instructions at https://github.com/nadavc/groovykoans#getting-started.

And regarding the power asserts - great idea! If you can spare the time, I'd really appreciate a pull request :)

— Reply to this email directly or view it on GitHubhttps://github.com/nadavc/groovykoans/issues/4#issuecomment-8866087.

http://twitter.com/#!/winkler1

winkler1 commented 12 years ago

Ahh, step 3. Somehow I missed on http://groovykoans.org/. Still... does not seem like it should be necessary, if that's technically possible.

nadavc commented 12 years ago

First of all - thanks for taking part in this project :)

The idea behind having the solutions embedded is to allow users to compare their own answers with the existing ones and perhaps learn from that comparison. It's also a way for me to make sure that those Koans are solvable once you fill in the blanks.

I guess I could have kept two copies of the same Koans - one with answers and one without - but I prefer having a single copy of the Koans...

I'll add another Q&A for removing the solutions and open a new issue for the Groovy power asserts.