File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -25,3 +25,33 @@ func TestTree_TreeEntry(t *testing.T) {
2525 assert .Equal (t , ObjectTree , e .Type ())
2626 assert .True (t , e .IsTree ())
2727}
28+
29+ func TestTree_Blob (t * testing.T ) {
30+ tree , err := testrepo .LsTree ("d58e3ef9f123eea6857161c79275ee22b228f659" )
31+ if err != nil {
32+ t .Fatal (err )
33+ }
34+
35+ t .Run ("not a blob" , func (t * testing.T ) {
36+ _ , err := tree .Blob ("src" )
37+ assert .Equal (t , ErrNotBlob , err )
38+ })
39+
40+ t .Run ("get a blob" , func (t * testing.T ) {
41+ b , err := tree .Blob ("README.txt" )
42+ if err != nil {
43+ t .Fatal (err )
44+ }
45+
46+ assert .True (t , b .IsBlob ())
47+ })
48+
49+ t .Run ("get an executable as blob" , func (t * testing.T ) {
50+ b , err := tree .Blob ("run.sh" )
51+ if err != nil {
52+ t .Fatal (err )
53+ }
54+
55+ assert .True (t , b .IsExec ())
56+ })
57+ }
You can’t perform that action at this time.
0 commit comments