This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

added support for Go language

  • Loading branch information...
JonJagger committed Apr 14, 2012
1 parent 6a43647 commit 54b5df8595d3131d487f5eb01584c8ee339d3a70
@@ -0,0 +1 @@
+go test
View
@@ -0,0 +1,9 @@
+
+{
+ :visible_filenames => %w( untitled.go untitled_test.go cyberdojo.sh ),
+
+ :unit_test_framework => 'go_testing',
+
+ :tab_size => 4
+}
+
View
@@ -0,0 +1,5 @@
+package untitled
+
+func hhg() int {
+ return 42
+}
@@ -0,0 +1,9 @@
+package untitled
+
+import ("testing")
+
+func Test_hhg(t *testing.T) {
+ if (hhg() != 54) {
+ t.Error("hhg() != 54 as expected.")
+ }
+}
View
@@ -205,5 +205,20 @@ def self.parse_googletest(output)
end
end
+ def self.parse_go_testing(output)
+ didnt_build_pattern = /\[build failed\]/
+ failed_pattern = /FAIL/
+ passed_pattern = /PASS/
+ if didnt_build_pattern.match(output)
+ :amber
+ elsif failed_pattern.match(output)
+ :red
+ elsif passed_pattern.match(output)
+ :green
+ else
+ :amber
+ end
+ end
+
end
@@ -83,5 +83,17 @@ class CodeOutputParserTests < ActionController::TestCase
assert_equal :amber, CodeOutputParser::parse_catch(amber_output)
end
+ test "go build failed is amber" do
+ assert_equal :amber, CodeOutputParser::parse_go_testing("[build failed]")
+ end
+ test "go ran but failed is green" do
+ assert_equal :red, CodeOutputParser::parse_go_testing("FAIL")
+ end
+ test "go ran and passed is red" do
+ assert_equal :green, CodeOutputParser::parse_go_testing("PASS")
+ end
+ test "go anything else is amber" do
+ assert_equal :amber, CodeOutputParser::parse_go_testing("anything else")
+ end
end

0 comments on commit 54b5df8

Please sign in to comment.