Exemplo n.º 1
0
func assertSymbolicRef(t *testing.T, symbolicRef objects.Ref, tget string) {
	symbolic, target := symbolicRef.Target()
	util.Assert(t, symbolic)
	if target == nil {
		t.Fatalf("nil target")
	}
	util.AssertEqualString(t, target.(string), tget)
	util.AssertPanic(t, func() {
		oid := target.(*objects.ObjectId)
		oid.String() // for compilation
	})
	util.AssertPanic(t, func() {
		oid := symbolicRef.ObjectId()
		oid.String() // for compilation
	})
}
Exemplo n.º 2
0
func Test_parseInvalidFileMode(t *testing.T) {
	// test non-file modes
	p := ObjectParserForString("000200\n002000\n000644\n000755\n0120200\n01600990\n")
	for !p.EOF() {
		util.AssertPanic(t, func() {
			m := p.ParseFileMode(token.LF)
			m++ // for compilation, should not get here
		})
	}
}
Exemplo n.º 3
0
func assertPeeledRef(t *testing.T, peeledRef objects.Ref, oid *objects.ObjectId) {
	symbolic, target := peeledRef.Target()
	util.Assert(t, !symbolic)
	if target == nil {
		t.Fatalf("nil target")
	}
	util.AssertEqualString(t, target.(*objects.ObjectId).String(), oid.String())
	util.AssertEqualString(t, peeledRef.ObjectId().String(), oid.String())
	util.AssertPanic(t, func() {
		s := target.(string)
		s += "" // for compilation
	})
}