Groovy

To install:

brew install groovy

Sample code (name this file test.groovy)

#!/usr/bin/env groovy
println "Hello from the shebang line"

def i = 0
def s = "abc"

assert i == 1
assert s.equals("abcd")

To run the test:

groovy test.groovy 

You will see that the test fails. And it will tell you where. =)

My version is Groovy Version: 2.4.3 JVM: 1.6.0_65 Vendor: Apple Inc. OS: Mac OS X. If you want to get rid of this annoying warning WARNING: Module [groovy-nio] – Unable to load extension class [org.codehaus.groovy.runtime.NioGroovyMethods], rename that library by

mv $GROOVY_HOME/lib/groovy-nio-2.4.3.jar $GROOVY_HOME/lib/groovy-nio-2.4.3.bak

ref link: http://stackoverflow.com/questions/24302887/how-to-disable-warning-for-niogroovymethods

To learn the groovy syntax, go to http://www.groovy-lang.org/syntax.html

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s