Skip to content

Commit 7a08bd9

Browse files
committed
adding support for groovy
1 parent cf97631 commit 7a08bd9

17 files changed

Lines changed: 111 additions & 34 deletions

File tree

‎koans/app/config/PathToEnlightenment.xml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@
3737
<package pkg="advanced" name="Advanced">
3838
<suite class="AboutMocks"/>
3939
</package>
40+
<package pkg="groovy" name="Groovy">
41+
<suite class="AboutGroovy"/>
42+
</package>
4043
</packages>

‎koans/app/lib/asm-4.1.jar‎

46.2 KB
Binary file not shown.

‎koans/app/lib/file-compiler.jar‎

2.62 KB
Binary file not shown.

‎koans/app/lib/file-monitor.jar‎

-34 Bytes
Binary file not shown.

‎koans/app/lib/groovy-2.2.1.jar‎

3.3 MB
Binary file not shown.

‎koans/app/lib/koans.jar‎

385 Bytes
Binary file not shown.

‎koans/src/beginner/AboutKoans.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public class AboutKoans {
88

99
@Koan
1010
public void findAboutKoansFile(){
11-
fail("delete this line");
11+
fail("delete this line");
1212
}
1313

1414
@Koan
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package groovy;
2+
3+
import com.sandwich.koan.Koan;
4+
import static com.sandwich.util.Assert.*;
5+
import static com.sandwich.koan.constant.KoanConstants.__;
6+
7+
class AboutGroovy {
8+
9+
@Koan
10+
public void installAndConfigureGroovyAndFindThisFile(){
11+
fail("Looks like you got Groovy installed, delete this line to move on.");
12+
}
13+
14+
@Koan groovyVoidAndPublicCanBeImplied(){
15+
fail("This wouldn't compile or be public in Java. Just delete or comment this line out.");
16+
}
17+
18+
@Koan groovySemicolonsOption(){
19+
fail("This wouldn't compile in Java because there's no semicolon.")
20+
}
21+
22+
@Koan groovyListLiteral(){
23+
def list = __
24+
assertEquals([1, 2, 3], list)
25+
}
26+
27+
@Koan groovyListLiteralIsAnArrayList(){
28+
def arrayListClass = __
29+
assertEquals([].getClass(), arrayListClass)
30+
}
31+
32+
}

‎lib/file-compiler/src/com/sandwich/util/io/StreamUtils.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
package com.sandwich.util.io;
22

33
import java.io.InputStream;
4+
import java.util.NoSuchElementException;
5+
import java.util.Scanner;
46

57
public class StreamUtils {
68

79
public static String convertStreamToString(InputStream stream) {
810
try {
9-
return new java.util.Scanner(stream).useDelimiter("\\A").next();
10-
} catch (java.util.NoSuchElementException e) {
11+
return new Scanner(stream).useDelimiter("\\A").next();
12+
} catch (NoSuchElementException e) {
1113
return "";
1214
}
1315
}

‎lib/file-compiler/src/com/sandwich/util/io/classloader/DynamicClassLoader.java‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Class<?> loadClass(String className, CompilationListener listener){
8080
File classFile = new File(fileName);
8181
try {
8282
// file may have never been compiled, go ahead and compile it now
83-
File sourceFile = FileCompiler.classToSource(binDir, sourceDir,classFile);
83+
File sourceFile = FileCompiler.classToSource(binDir, sourceDir, classFile);
8484
if(classFile.exists()){
8585
String absolutePath = classFile.getAbsolutePath();
8686
boolean isAnonymous = absolutePath.contains("$");

0 commit comments

Comments
 (0)