Permalink
Browse files

Build using the `go` tool instead of Makefiles, upgraded to Go weekly…

….2012-02-07
  • Loading branch information...
1 parent 3fee6c9 commit 903b32e916c0cfd884862e6157414723acc501ce @orfjackal committed Feb 14, 2012
View
@@ -1,5 +1 @@
-6.out
-*.6
-_obj
-_test
-_testmain.go
+/pkg/
View
@@ -17,42 +17,35 @@ First you must have Go installed on your machine, as instructed in [Installing G
### Install and Update
-Checkout GoSpec's source code from its Git repository and install it. The `release` branch is checked out by default. The `make install` command will copy the compiled GoSpec library into your `$GOROOT/pkg` directory, so that it can be used from other projects.
+Download GoSpec using the `go get` tool:
- git clone git://github.com/orfjackal/gospec.git
- cd gospec/src
- make install
+ go get "github.com/orfjackal/gospec/src/gospec"
-When new versions of GoSpec are released, you can update it by pulling the latest version (from the `release` branch) and then installing it as above.
-
- git pull
- make install
+See `go help get` for more instructions on using the tool.
See "Version History" for any additional upgrade notes.
-(If you want to develop GoSpec and run its tests with `make test`, you must first install GoSpec's bootstrap testing framework, [NanoSpec.go](http://github.com/orfjackal/nanospec.go), but regular users of GoSpec don't need to install it.)
-
### Sample Project
-Make a copy of the [hello-world-template] directory to get started. You can run its tests with the command `make test`. All production files must be listed in `Makefile`, all test files must end with `_test.go` and all specs must be listed in `all_specs_test.go`.
+Make a copy of the [hello-world-template] directory to get started. You can run its tests with the `go test` command. All test files must end with `_test.go` and all specs must be listed in `all_specs_test.go`.
### Running Specs
-You can use the [gotest command](http://golang.org/cmd/gotest/) to run GoSpec's specs. The integration with gotest requires a couple of lines of boilerplate: you'll need to write a gotest test method, where you list all your specs and call GoSpec. See [all_specs_test.go] in the [examples] directory for an example. Also all your specs must be in files whose names end with `_test.go`.
+You can use the `go test` command to run GoSpec's specs. The integration with gotest requires a couple of lines of boilerplate: you'll need to write a gotest test method, where you list all your specs and call GoSpec. See [all_specs_test.go] in the [examples] directory for an example. Also all your specs must be in files whose names end with `_test.go`.
See [gotest's documentation](http://golang.org/doc/code.html#Testing) for instructions on how to use gotest.
-GoSpec adds one additional parameter to gotest. Use the `-print-all` parameter to print a list of all specs (either `gotest -print-all` or run the binary generated by gotest: `./6.out -print-all`). By default only the failing specs are printed. The list of all specs can be useful as documentation.
+GoSpec adds one additional parameter to gotest. Use the `-print-all` parameter to print a list of all specs: `go test -print-all` Otherwise only the failing specs are printed. The list of all specs can be useful as documentation.
### Writing Specs
The following imports are needed. The first imports the `gospec.Context` interface and the second is needed for using GoSpec's expectation matchers (`Equals`, `IsTrue`, `IsNil`, `Not()`, `Contains` etc.) without having to prefix them with the package name. (In a future GoSpec version the matchers will be moved to their own package.)
- import "gospec"
- import . "gospec"
+ import "github.com/orfjackal/gospec/src/gospec"
+ import . "github.com/orfjackal/gospec/src/gospec"
The specs are written as functions which take `gospec.Context` as a parameter. You can call the methods of `Context` to declare expectations and nested specs.
@@ -69,23 +62,24 @@ For examples on how to write specs, see the files in the [examples] directory.
<!---
Replace /master/ with /gospec-1.x.x/ before making a release.
-->
-[hello-world-template]: http://github.com/orfjackal/gospec/tree/master/hello-world-template/
-[examples]: http://github.com/orfjackal/gospec/tree/master/examples/
-[all_specs_test.go]: http://github.com/orfjackal/gospec/blob/master/examples/all_specs_test.go
-[fib.go]: http://github.com/orfjackal/gospec/blob/master/examples/fib.go
-[fib_test.go]: http://github.com/orfjackal/gospec/blob/master/examples/fib_test.go
-[stack.go]: http://github.com/orfjackal/gospec/blob/master/examples/stack.go
-[stack_test.go]: http://github.com/orfjackal/gospec/blob/master/examples/stack_test.go
-[expectation_syntax_test.go]: http://github.com/orfjackal/gospec/blob/master/examples/expectation_syntax_test.go
-[execution_model_test.go]: http://github.com/orfjackal/gospec/blob/master/examples/execution_model_test.go
+[hello-world-template]: http://github.com/orfjackal/gospec/tree/master/src/hello-world-template/
+[examples]: http://github.com/orfjackal/gospec/tree/master/src/examples/
+[all_specs_test.go]: http://github.com/orfjackal/gospec/blob/master/src/examples/all_specs_test.go
+[fib.go]: http://github.com/orfjackal/gospec/blob/master/src/examples/fib.go
+[fib_test.go]: http://github.com/orfjackal/gospec/blob/master/src/examples/fib_test.go
+[stack.go]: http://github.com/orfjackal/gospec/blob/master/src/examples/stack.go
+[stack_test.go]: http://github.com/orfjackal/gospec/blob/master/src/examples/stack_test.go
+[expectation_syntax_test.go]: http://github.com/orfjackal/gospec/blob/master/src/examples/expectation_syntax_test.go
+[execution_model_test.go]: http://github.com/orfjackal/gospec/blob/master/src/examples/execution_model_test.go
Version History
---------------
**1.x.x (2011-xx-xx)**
-- Upgraded to Go weekly.2012-01-27
+- Build using the `go` tool instead of Makefiles
+- Upgraded to Go weekly.2012-02-07
**1.3.8 (2011-08-04)**
@@ -180,6 +174,6 @@ The following are *nice-to-haves*, which make it more pleasant to use the framew
License
-------
-Copyright © 2009-2011 Esko Luontola <<http://www.orfjackal.net>>
+Copyright © 2009-2012 Esko Luontola <<http://www.orfjackal.net>>
This software is released under the Apache License 2.0.
The license text is at <http://www.apache.org/licenses/LICENSE-2.0>
View
@@ -1,10 +0,0 @@
-include $(GOROOT)/src/Make.inc
-
-TARG=gospec/examples
-GOFILES=\
- fib.go\
- point.go\
- stack.go\
-
-include $(GOROOT)/src/Make.pkg
-
@@ -1,8 +0,0 @@
-include $(GOROOT)/src/Make.inc
-
-TARG=hello
-GOFILES=\
- hello.go\
-
-include $(GOROOT)/src/Make.pkg
-
View
@@ -1 +0,0 @@
-gospec.install:
View
@@ -1,44 +0,0 @@
-include $(GOROOT)/src/Make.inc
-
-#Run 'make deps' if you add or change new folders.
-DIRS=\
- gospec\
-
-TEST=\
- gospec\
-
-all.dirs: $(addsuffix .all, $(DIRS))
-clean.dirs: $(addsuffix .clean, $(DIRS))
-install.dirs: $(addsuffix .install, $(DIRS))
-test.dirs: $(addsuffix .test, $(TEST))
-docs.dirs: $(addsuffix .docs, $(DIRS))
-
-%.all:
- +cd $* && make
-
-%.clean:
- +cd $* && make clean
-
-%.install:
- +cd $* && make install
-
-%.test:
- +cd $* && make test
-
-%.docs:
- +godoc -pkgroot="." -html -v $* > docs/$*.html
-
-
-clean: clean.dirs
-
-install: install.dirs
-
-test: test.dirs
-
-docs: docs.dirs
-
-deps:
- ./deps.bash
-
-include Make.deps
-
View
@@ -1,37 +0,0 @@
-#!/bin/bash
-# Copyright 2009 The Go Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file.
-
-OUT="Make.deps"
-TMP="Make.deps.tmp"
-
-if [ -f $OUT ] && ! [ -w $OUT ]; then
- echo "$0: $OUT is read-only; aborting." 1>&2
- exit 1
-fi
-
-# Get list of directories from Makefile
-dirs=$(sed '1,/^DIRS=/d; /^$/,$d; s/\\//g' Makefile)
-dirpat=$(echo $dirs | sed 's/ /|/g; s/.*/^(&)$/')
-
-for dir in $dirs; do (
- cd $dir || exit 1
-
- sources=$(sed -n 's/\.go\\/.go/p' Makefile)
- sources=$(ls $sources 2> /dev/null) # remove .s, .c, etc.
-
- deps=$(
- sed -n '/^import.*"/p; /^import[ \t]*(/,/^)/p' $sources /dev/null |
- cut -d '"' -f2 |
- egrep "$dirpat" |
- grep -v "^$dir\$" |
- sed 's/$/.install/' |
- sort -u
- )
-
- echo $dir.install: $deps
-) done > $TMP
-
-mv $TMP $OUT
-
@@ -5,7 +5,7 @@
package examples
import (
- "gospec"
+ "github.com/orfjackal/gospec/src/gospec"
"testing"
)
@@ -5,8 +5,8 @@
package examples
import (
- "gospec"
- . "gospec"
+ "github.com/orfjackal/gospec/src/gospec"
+ . "github.com/orfjackal/gospec/src/gospec"
"strings"
)
@@ -6,8 +6,8 @@ package examples
import (
"container/list"
- "gospec" // the "gospec.Context" interface
- . "gospec" // the expectation matchers (Equals, IsTrue etc.), will later be renamed to "gospec/matchers"
+ "github.com/orfjackal/gospec/src/gospec" // the "gospec.Context" interface
+ . "github.com/orfjackal/gospec/src/gospec" // the expectation matchers (Equals, IsTrue etc.), will later be renamed to "gospec/matchers"
"os"
)
File renamed without changes.
@@ -5,8 +5,8 @@
package examples
import (
- "gospec"
- . "gospec"
+ "github.com/orfjackal/gospec/src/gospec"
+ . "github.com/orfjackal/gospec/src/gospec"
)
// The specs should read like a specification. The spec names in this example
File renamed without changes.
File renamed without changes.
@@ -5,8 +5,8 @@
package examples
import (
- "gospec"
- . "gospec"
+ "github.com/orfjackal/gospec/src/gospec"
+ . "github.com/orfjackal/gospec/src/gospec"
)
// This is the style that I've found the most useful in organizing tests.
View
@@ -1,23 +0,0 @@
-include $(GOROOT)/src/Make.inc
-
-TARG=gospec
-GOFILES=\
- context.go\
- error.go\
- funcname.go\
- location.go\
- main.go\
- matchers.go\
- printer.go\
- print_format.go\
- recover.go\
- results.go\
- runner.go\
- specification.go\
-
-# Must disable inlining, or tests will fail because of stack traces
-# not containing the innermost method call.
-GCFLAGS+=-l
-
-include $(GOROOT)/src/Make.pkg
-
@@ -5,7 +5,7 @@
package gospec
import (
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
"testing"
)
@@ -6,7 +6,7 @@ package gospec
import (
"math"
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
"time"
)
@@ -5,7 +5,7 @@
package gospec
import (
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
)
func ContextSpec(c nanospec.Context) {
@@ -5,7 +5,7 @@
package gospec
import (
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
"sort"
)
@@ -5,7 +5,7 @@
package gospec
import (
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
)
func ExpectationsSpec(c nanospec.Context) {
@@ -5,7 +5,7 @@
package gospec
import (
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
"strings"
)
@@ -5,7 +5,7 @@
package gospec
import (
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
"runtime"
)
@@ -9,7 +9,7 @@ import (
"errors"
"fmt"
"math"
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
"os"
)
@@ -6,7 +6,7 @@ package gospec
import (
"bytes"
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
"strings"
)
@@ -5,7 +5,7 @@
package gospec
import (
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
)
func boom2() {
@@ -7,7 +7,7 @@ package gospec
import (
"bytes"
"errors"
- "nanospec"
+ "github.com/orfjackal/nanospec.go/src/nanospec"
"strings"
)
View
@@ -0,0 +1,6 @@
+#!/bin/sh
+set -e
+
+# Must disable inlining, or tests will fail because of stack traces
+# not containing the innermost method call.
+GCFLAGS="-l" go test
@@ -1,7 +1,7 @@
package hello
import (
- "gospec"
+ "github.com/orfjackal/gospec/src/gospec"
"testing"
)
Oops, something went wrong.

0 comments on commit 903b32e

Please sign in to comment.