Sha256: da846ff8e8f0c6221eff4f325cc850d861a4539b7b4302133c3d1d43d3540d48

Contents?: true

Size: 1.29 KB

Versions: 9

Compression:

Stored size: 1.29 KB

Contents

package greeting

import "testing"

// Define a function named HelloWorld that takes no arguments,
// and returns a string.
// In other words, define a function with the following signature:
// HelloWorld() string
//
// In any exercise solution using the following tests you must also define a
// "testVersion" constant with a value that matches the targetTestVersion
// here. See how it is done in the the ./hello_world.go file provided.
// This is a common convention for ensuring test consistency throughout the
// Exercism Go language track.
//
// See TestTestVersion function below for how this and the testVersion
// constants are used.
const targetTestVersion = 4

// TestTestVersion is used to ensure the exercise solution is considered
// compatible with the rest of the tests. It should be the initial testing
// function in any test suite. If there is an incompatibility the tests can
// be considered unreliable therefore this function will abort the testing.
func TestTestVersion(t *testing.T) {
	if testVersion != targetTestVersion {
		t.Fatalf("Found testVersion = %v, want %v", testVersion, targetTestVersion)
	}
}

func TestHelloWorld(t *testing.T) {
	expected := "Hello, World!"
	if observed := HelloWorld(); observed != expected {
		t.Fatalf("HelloWorld() = %v, want %v", observed, expected)
	}
}

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
trackler-2.0.8.9 tracks/go/exercises/hello-world/hello_test.go
trackler-2.0.8.8 tracks/go/exercises/hello-world/hello_test.go
trackler-2.0.8.7 tracks/go/exercises/hello-world/hello_test.go
trackler-2.0.8.6 tracks/go/exercises/hello-world/hello_test.go
trackler-2.0.8.5 tracks/go/exercises/hello-world/hello_test.go
trackler-2.0.8.4 tracks/go/exercises/hello-world/hello_test.go
trackler-2.0.8.3 tracks/go/exercises/hello-world/hello_test.go
trackler-2.0.8.2 tracks/go/exercises/hello-world/hello_test.go
trackler-2.0.8.1 tracks/go/exercises/hello-world/hello_test.go