-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(dscache): A few dscache improvements
Allow nilable dscache. Require context for constructor. Minor style cleanups.
- Loading branch information
Showing
9 changed files
with
74 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,33 @@ | ||
package dscache | ||
|
||
// TODO(dlong): Test LoadDscacheFromFile | ||
// TODO(dlong): Test SaveTo | ||
// TODO(dlong): Test ListRefs | ||
import ( | ||
"strings" | ||
"testing" | ||
|
||
"github.com/qri-io/qri/logbook" | ||
) | ||
|
||
// TODO(dlong): Test NewDscache, IsEmpty, Assign, ListRefs, Update | ||
|
||
func TestNilCallable(t *testing.T) { | ||
var ( | ||
cache *Dscache | ||
err error | ||
) | ||
|
||
if !cache.IsEmpty() { | ||
t.Errorf("expected IsEmpty: got !IsEmpty") | ||
} | ||
if err = cache.Assign(&Dscache{}); err != ErrNoDscache { | ||
t.Errorf("expected '%s': got '%s'", ErrNoDscache, err) | ||
} | ||
if str := cache.VerboseString(true); !strings.Contains(str, "empty dscache") { | ||
t.Errorf("expected str to Contain 'empty dscache': got '%s'", str) | ||
} | ||
if _, err = cache.ListRefs(); err != ErrNoDscache { | ||
t.Errorf("expected '%s': got '%s'", ErrNoDscache, err) | ||
} | ||
if err = cache.Update(&logbook.Action{}); err != ErrNoDscache { | ||
t.Errorf("expected '%s': got '%s'", ErrNoDscache, err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters