File: testutil_test.go

package info (click to toggle)
golang-github-dop251-goja 0.0~git20170430.0.d382686-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 964 kB
  • sloc: javascript: 454; perl: 184; makefile: 6
file content (32 lines) | stat: -rw-r--r-- 482 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package parser

import (
	"fmt"
	"runtime"
	"testing"
	"path/filepath"
)

// Quick and dirty replacement for terst

func tt(t *testing.T, f func()) {
	defer func() {
		if x := recover(); x != nil {
			_, file, line, _ := runtime.Caller(5)
			t.Errorf("Error at %s:%d: %v", filepath.Base(file), line, x)
		}
	}()

	f()
}


func is(a, b interface{}) {
	as := fmt.Sprintf("%v", a)
	bs := fmt.Sprintf("%v", b)
	if as != bs {
		panic(fmt.Errorf("%+v(%T) != %+v(%T)", a, a, b, b))
	}
}