From 6213feac8d00f0c7cca5d718bf78b1581142a399 Mon Sep 17 00:00:00 2001 From: Steven Degutis Date: Sat, 10 Mar 2012 23:42:39 -0600 Subject: [PATCH] moving stuff around or something --- arrays.go | 8 ++++++++ basics.go | 5 +++-- setup_koans_test.go | 10 ++++++---- strings.go | 7 +++++++ 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 arrays.go create mode 100644 strings.go diff --git a/arrays.go b/arrays.go new file mode 100644 index 0000000..6742f2f --- /dev/null +++ b/arrays.go @@ -0,0 +1,8 @@ +package go_koans + +var __string__ string + +func testArrays() { + fruits := [3]string{"apple", "orange"} + assert(fruits[0] == __string__) +} diff --git a/basics.go b/basics.go index 1ab89f6..09b06da 100644 --- a/basics.go +++ b/basics.go @@ -1,7 +1,8 @@ package go_koans -var __ interface{} +var __ bool func testBasics() { - assert(__ == true) // what is truth? + //assert(__ == true) // what is truth? + //assert(!__ != true) // in it there is nothing false } diff --git a/setup_koans_test.go b/setup_koans_test.go index 75f6d39..febb2b5 100644 --- a/setup_koans_test.go +++ b/setup_koans_test.go @@ -12,13 +12,15 @@ import ( func TestKoans(t *testing.T) { testBasics() - fmt.Printf("%c[32m", 27) + testStrings() + testArrays() + + fmt.Printf("\n%c[32;1mYou won life. Good job.\n\n", 27) } func assert(o bool) { if !o { - fmt.Printf("%c[35m", 27) - fmt.Printf("%s\n\n", __getRecentLine()) + fmt.Printf("\n%c[35m%s\n\n", 27, __getRecentLine()) os.Exit(1) } } @@ -27,5 +29,5 @@ func __getRecentLine() string { _, file, line, _ := runtime.Caller(2) buf, _ := ioutil.ReadFile(file) code := strings.TrimSpace(strings.Split(string(buf), "\n")[line-1]) - return fmt.Sprintf("\n%v:%d\n%s", path.Base(file), line, code) + return fmt.Sprintf("%v:%d\n%s", path.Base(file), line, code) } diff --git a/strings.go b/strings.go new file mode 100644 index 0000000..b5d5d92 --- /dev/null +++ b/strings.go @@ -0,0 +1,7 @@ +package go_koans + +func testStrings() { + //var __ string + + //assert("a" + __ == "abc") +}