Introduced line printer using the go package, so that the full statement
is printed rather than just the reported line, making it easier to debug
problems.  Not in use yet.
diff --git a/Makefile b/Makefile
index f4483a9..7cda2de 100644
--- a/Makefile
+++ b/Makefile
@@ -8,6 +8,7 @@
 	helpers.go\
 	run.go\
 	checkers.go\
+	printer.go\
 
 include $(GOROOT)/src/Make.pkg
 
diff --git a/export_test.go b/export_test.go
new file mode 100644
index 0000000..8df633e
--- /dev/null
+++ b/export_test.go
@@ -0,0 +1,13 @@
+package gocheck
+
+import (
+    "os"
+)
+
+func PrintLine(filename string, line int) (string, os.Error) {
+    return printLine(filename, line)
+}
+
+func Indent(s, with string) string {
+    return indent(s, with)
+}
diff --git a/foundation_test.go b/foundation_test.go
index 64d8964..c7a8418 100644
--- a/foundation_test.go
+++ b/foundation_test.go
@@ -149,7 +149,7 @@
 
 func (s *FoundationS) TestCallerLoggingInsideTest(c *gocheck.C) {
     log := fmt.Sprintf(""+
-        "foundation_test.go:%d:\n"+
+        "foundation_test.go:%d:\n"+ //"    result := c.Check(10, gocheck.Equals, 20)\n"+
         "\\.\\.\\. Check\\(obtained, Equals, expected\\):\n"+
         "\\.\\.\\. obtained = \\(int\\) 10\n"+
         "\\.\\.\\. expected = \\(int\\) 20\n\n",
diff --git a/gocheck.go b/gocheck.go
index 3cc765c..22e72d2 100644
--- a/gocheck.go
+++ b/gocheck.go
@@ -1,18 +1,18 @@
 package gocheck
 
 import (
-    "reflect"
-    "runtime"
-    "strings"
-    "strconv"
-    "regexp"
     "bytes"
-    "path"
-    "sync"
-    "rand"
     "fmt"
     "io"
     "os"
+    "path"
+    "rand"
+    "reflect"
+    "regexp"
+    "runtime"
+    "strconv"
+    "strings"
+    "sync"
 )
 
 
@@ -191,8 +191,7 @@
                 }
             }
         }
-        if testFile != "" && (testFile != callerFile ||
-            testLine != callerLine) {
+        if testFile != "" && (testFile != callerFile || testLine != callerLine) {
             c.logf("%s:%d > %s:%d:\n... %s", nicePath(testFile), testLine,
                 nicePath(callerFile), callerLine, issue)
         } else {
diff --git a/gocheck_test.go b/gocheck_test.go
index f557ac3..1f01f42 100644
--- a/gocheck_test.go
+++ b/gocheck_test.go
@@ -18,7 +18,7 @@
 // We count the number of suites run at least to get a vague hint that the
 // test suite is behaving as it should.  Otherwise a bug introduced at the
 // very core of the system could go unperceived.
-const suitesRunExpected = 6
+const suitesRunExpected = 7
 
 var suitesRun int = 0
 
diff --git a/printer.go b/printer.go
new file mode 100644
index 0000000..b7e3acc
--- /dev/null
+++ b/printer.go
@@ -0,0 +1,124 @@
+package gocheck
+
+import (
+    "bytes"
+    "go/ast"
+    "go/parser"
+    "go/token"
+    "go/printer"
+    "os"
+)
+
+func indent(s, with string) (r string) {
+    eol := true
+    for i := 0; i != len(s); i++ {
+        c := s[i]
+        switch {
+        case eol && c == '\n' || c == '\r':
+        case c == '\n' || c == '\r':
+            eol = true
+        case eol:
+            eol = false
+            s = s[:i] + with + s[i:]
+            i += len(with)
+        }
+    }
+    return s
+}
+
+func printLine(filename string, line int) (string, os.Error) {
+    fset := token.NewFileSet()
+    file, err := os.Open(filename, os.O_RDONLY, 0)
+    if err != nil {
+        return "", err
+    }
+    fnode, err := parser.ParseFile(fset, filename, file, 0)
+    if err != nil {
+        return "", err
+    }
+    config := &printer.Config{Mode: printer.UseSpaces, Tabwidth: 4}
+    lp := &linePrinter{fset: fset, line: line, config: config}
+    ast.Walk(lp, fnode)
+    return lp.output.String(), nil
+}
+
+type linePrinter struct {
+    fset *token.FileSet
+    line int
+    output bytes.Buffer
+    stmt ast.Stmt
+    config *printer.Config
+}
+
+func (lp *linePrinter) Visit(n ast.Node) (w ast.Visitor) {
+    if n == nil {
+        return nil
+    }
+    if stmt, ok := n.(ast.Stmt); ok {
+        lp.stmt = stmt
+    }
+    p := n.Pos()
+    line := lp.fset.Position(p).Line
+    if line == lp.line {
+        lp.trim(lp.stmt)
+        lp.config.Fprint(&lp.output, lp.fset, lp.stmt)
+        return nil
+    }
+    return lp
+}
+
+func (lp *linePrinter) trim(n ast.Node) bool {
+    stmt, ok := n.(ast.Stmt)
+    if !ok {
+        return true
+    }
+    p := n.Pos()
+    line := lp.fset.Position(p).Line
+    if line != lp.line {
+        return false
+    }
+    switch stmt := stmt.(type) {
+    case *ast.IfStmt:
+        stmt.Body = lp.trimBlock(stmt.Body)
+    case *ast.SwitchStmt:
+        stmt.Body = lp.trimBlock(stmt.Body)
+    case *ast.TypeSwitchStmt:
+        stmt.Body = lp.trimBlock(stmt.Body)
+    case *ast.CaseClause:
+        stmt.Body = lp.trimList(stmt.Body)
+    case *ast.TypeCaseClause:
+        stmt.Body = lp.trimList(stmt.Body)
+    case *ast.CommClause:
+        stmt.Body = lp.trimList(stmt.Body)
+    case *ast.BlockStmt:
+        stmt.List = lp.trimList(stmt.List)
+    }
+    return true
+}
+
+func (lp *linePrinter) trimBlock(stmt *ast.BlockStmt) *ast.BlockStmt {
+    if !lp.trim(stmt) {
+        return lp.emptyBlock(stmt)
+    }
+    stmt.Rbrace = stmt.Lbrace
+    return stmt
+}
+
+func (lp *linePrinter) trimList(stmts []ast.Stmt) []ast.Stmt {
+    for i := 0; i != len(stmts); i++ {
+        if !lp.trim(stmts[i]) {
+            stmts[i] = lp.emptyStmt(stmts[i])
+            break
+        }
+    }
+    return stmts
+}
+
+func (lp *linePrinter) emptyStmt(n ast.Node) *ast.ExprStmt {
+    return &ast.ExprStmt{&ast.Ellipsis{n.Pos(), nil}}
+}
+
+func (lp *linePrinter) emptyBlock(n ast.Node) *ast.BlockStmt {
+    p := n.Pos()
+    return &ast.BlockStmt{p, []ast.Stmt{lp.emptyStmt(n)}, p}
+}
diff --git a/printer_test.go b/printer_test.go
new file mode 100644
index 0000000..3cafd4b
--- /dev/null
+++ b/printer_test.go
@@ -0,0 +1,83 @@
+package gocheck_test
+
+import (
+    . "gocheck"
+)
+
+var _ = Suite(&PrinterS{})
+
+type PrinterS struct{}
+
+func (s *PrinterS) TestCountSuite(c *C) {
+    suitesRun += 1
+}
+
+var printTestFuncLine int
+
+func init() {
+    printTestFuncLine = getMyLine() + 3
+}
+
+func printTestFunc() {
+    println(1)
+    if 2 == 2 {
+        println(3)
+    }
+    switch 5 {
+    case 6: println(6)
+        println(7)
+    }
+    switch interface{}(9).(type) {
+    case int: println(10)
+        println(11)
+    }
+    select {
+    case <-(chan bool)(nil): println(14)
+        println(15)
+    default: println(16)
+        println(17)
+    }
+    println(19,
+        20)
+}
+
+var printLineTests = []struct{line int; output string}{
+    {1, "println(1)"},
+    {2, "if 2 == 2 {\n    ...\n}"},
+    {3, "println(3)"},
+    {5, "switch 5 {\n...\n}"},
+    {6, "case 6:\n    println(6)\n    ..."},
+    {7, "println(7)"},
+    {9, "switch interface{}(9).(type) {\n...\n}"},
+    {10, "case int:\n    println(10)\n    ..."},
+    {14, "case <-(chan bool)(nil):\n    println(14)\n    ..."},
+    {15, "println(15)"},
+    {16, "default:\n    println(16)\n    ..."},
+    {17, "println(17)"},
+    {19, "println(19,\n    20)"},
+}
+
+func (s *PrinterS) TestPrintLine(c *C) {
+    for _, test := range printLineTests {
+        output, err := PrintLine("printer_test.go", printTestFuncLine+test.line)
+        c.Assert(err, IsNil)
+        c.Assert(output, Equals, test.output)
+    }
+}
+
+var indentTests = []struct{in, out string}{
+    {"", ""},
+    {"\n", "\n"},
+    {"a", ">>>a"},
+    {"a\n", ">>>a\n"},
+    {"a\nb", ">>>a\n>>>b"},
+    {" ", ">>> "},
+}
+
+func (s *PrinterS) TestIndent(c *C) {
+    for _, test := range indentTests {
+        out := Indent(test.in, ">>>")
+        c.Assert(out, Equals, test.out)
+    }
+
+}