aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--exercises/if/if2/main_test.go36
-rw-r--r--info.toml7
2 files changed, 43 insertions, 0 deletions
diff --git a/exercises/if/if2/main_test.go b/exercises/if/if2/main_test.go
new file mode 100644
index 0000000..5119dab
--- /dev/null
+++ b/exercises/if/if2/main_test.go
@@ -0,0 +1,36 @@
+// if1
+// Make me compile!
+
+// I AM NOT DONE
+package main_test
+
+import "testing"
+
+func fooIfFizz(fizzish string) string {
+ if fizzish == "fizz" {
+ return "foo"
+ } else {
+ return "complete me"
+ }
+}
+
+func TestFooForFizz(t *testing.T) {
+ result := fooIfFizz("fizz")
+ if result != "foo" {
+ t.Errorf("should be 'foo' but got %s", result)
+ }
+}
+
+func TestBarForFuzz(t *testing.T) {
+ result := fooIfFizz("fuzz")
+ if result != "bar" {
+ t.Errorf("should be 'bar' but got %s", result)
+ }
+}
+
+func TestDefaultForBazz(t *testing.T) {
+ result := fooIfFizz("random stuff")
+ if result != "baz" {
+ t.Errorf("should be 'baz' but got %s", result)
+ }
+}
diff --git a/info.toml b/info.toml
index 309eabe..d0ec349 100644
--- a/info.toml
+++ b/info.toml
@@ -75,3 +75,10 @@ path = "exercises/if/if1/main_test.go"
mode = "test"
hint = """
"""
+
+[[exercises]]
+name = "if2"
+path = "exercises/if/if2/main_test.go"
+mode = "test"
+hint = """
+"""