diff --git a/about_allocation.go b/about_allocation.go index 73199f5..235c0ad 100644 --- a/about_allocation.go +++ b/about_allocation.go @@ -1,6 +1,6 @@ package go_koans -func testAllocation() { +func aboutAllocation() { a := new(int) *a = 3 assert(*a == __int__) // new() creates a pointer to the given type, like malloc() in C diff --git a/about_anonymous_functions.go b/about_anonymous_functions.go index 06d4566..c3cc5ad 100644 --- a/about_anonymous_functions.go +++ b/about_anonymous_functions.go @@ -1,6 +1,6 @@ package go_koans -func testAnonymousFunctions() { +func aboutAnonymousFunctions() { { i := 1 increment := func() { diff --git a/about_arrays.go b/about_arrays.go index e4d0996..0595d6d 100644 --- a/about_arrays.go +++ b/about_arrays.go @@ -1,6 +1,6 @@ package go_koans -func testArrays() { +func aboutArrays() { fruits := [4]string{"apple", "orange", "mango"} assert(fruits[0] == __string__) // indexes begin at 0 diff --git a/about_control_flow.go b/about_control_flow.go index 69dc40b..10a0b0e 100644 --- a/about_control_flow.go +++ b/about_control_flow.go @@ -2,7 +2,7 @@ package go_koans import "fmt" -func testControlFlow() { +func aboutControlFlow() { { a, b, c := 1, 2, 3 assert(a == __int__) // multiple assignment diff --git a/about_enumeration.go b/about_enumeration.go index 7739519..c8acd9c 100644 --- a/about_enumeration.go +++ b/about_enumeration.go @@ -1,6 +1,6 @@ package go_koans -func testEnumeration() { +func aboutEnumeration() { { var concatenated string var total int diff --git a/about_files.go b/about_files.go index 539d84f..811c6dd 100644 --- a/about_files.go +++ b/about_files.go @@ -3,7 +3,7 @@ package go_koans import "io/ioutil" import "strings" -func testFiles() { +func aboutFiles() { filename := "about_files.go" contents, _ := ioutil.ReadFile(filename) lines := strings.Split(string(contents), "\n") diff --git a/about_interfaces.go b/about_interfaces.go index 589caa5..7e3858f 100644 --- a/about_interfaces.go +++ b/about_interfaces.go @@ -1,6 +1,6 @@ package go_koans -func testInterfaces() { +func aboutInterfaces() { mspaint := &program{3} // mspaint is a kind of *program, which is a valid 'runner' runOnce(mspaint) // runOnce takes an abstract 'runner' type diff --git a/about_maps.go b/about_maps.go index 2d921fc..a2fe643 100644 --- a/about_maps.go +++ b/about_maps.go @@ -1,6 +1,6 @@ package go_koans -func testMaps() { +func aboutMaps() { ages := map[string]int{ "bob": 10, "joe": 20, diff --git a/about_numbers.go b/about_numbers.go index aa205fb..7d30d56 100644 --- a/about_numbers.go +++ b/about_numbers.go @@ -1,6 +1,6 @@ package go_koans -func testNumbers() { +func aboutNumbers() { assert(__bool__ == true) // what is truth? assert(__bool__ != false) // in it there is nothing false diff --git a/about_pointers.go b/about_pointers.go index 8289d95..6e7975d 100644 --- a/about_pointers.go +++ b/about_pointers.go @@ -1,6 +1,6 @@ package go_koans -func testPointers() { +func aboutPointers() { { a := 3 b := a // 'b' is a copy of 'a' (all assignments are copy-operations) diff --git a/about_slices.go b/about_slices.go index eb89316..dad1db3 100644 --- a/about_slices.go +++ b/about_slices.go @@ -1,6 +1,6 @@ package go_koans -func testSlices() { +func aboutSlices() { fruits := []string{"apple", "orange", "mango"} assert(fruits[0] == __string__) // slices seem like arrays diff --git a/about_strings.go b/about_strings.go index d8914e3..dc0bcdb 100644 --- a/about_strings.go +++ b/about_strings.go @@ -2,7 +2,7 @@ package go_koans import "fmt" -func testStrings() { +func aboutStrings() { assert("a" + __string__ == "abc") // string concatenation need not be difficult assert(len("abc") == __int__) // and bounds are thoroughly checked diff --git a/about_structs.go b/about_structs.go index b095ea5..c971bde 100644 --- a/about_structs.go +++ b/about_structs.go @@ -1,6 +1,6 @@ package go_koans -func testStructs() { +func aboutStructs() { var bob struct { name string age int diff --git a/about_variadic_functions.go b/about_variadic_functions.go index c6f74ff..cb78278 100644 --- a/about_variadic_functions.go +++ b/about_variadic_functions.go @@ -6,7 +6,7 @@ func concatNames(sep string, names ...string) string { return strings.Join(names, sep) // variadic parameters are really just slices } -func testVariadicFunctions() { +func aboutVariadicFunctions() { { str := concatNames(" ", "bob", "billy", "fred") assert(str == __string__) // several values can be passed to variadic parameters diff --git a/setup_koans_test.go b/setup_koans_test.go index e6a7892..e1595c9 100644 --- a/setup_koans_test.go +++ b/setup_koans_test.go @@ -17,25 +17,25 @@ var __bool__ bool = false // ugh var __float32__ float32 = -1.0 func TestKoans(t *testing.T) { - //testNumbers() - //testStrings() - //testArrays() - //testSlices() - //testControlFlow() - //testEnumeration() - //testAnonymousFunctions() - //testVariadicFunctions() - //testFiles() - //testInterfaces() - //testMaps() - //testPointers() - //testStructs() - testAllocation() + //aboutNumbers() + //aboutStrings() + //aboutArrays() + //aboutSlices() + //aboutControlFlow() + //aboutEnumeration() + //aboutAnonymousFunctions() + //aboutVariadicFunctions() + //aboutFiles() + //aboutInterfaces() + //aboutMaps() + //aboutPointers() + //aboutStructs() + aboutAllocation() // TODO: ie, gameplan - //testGoroutines() - //testChannels() - //testPanics() + //aboutGoroutines() + //aboutChannels() + //aboutPanics() fmt.Printf("\n%c[32;1mYou won life. Good job.\n\n", 27) }