Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
unit: split out TestHashFromHexString
Browse files Browse the repository at this point in the history
  • Loading branch information
jonboulle authored and kayrus committed Mar 29, 2016
1 parent a79141c commit bbea486
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions unit/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,16 @@ func TestUnitHash(t *testing.T) {
if !eh.Empty() {
t.Fatalf("Empty hash check failed: %v", eh.Empty())
}
}

func TestHashFromHexString(t *testing.T) {
u, err := NewUnitFile("[Service]\nExecStart=/bin/sleep 100\n")
if err != nil {
t.Fatalf("Unexpected error encountered creating unit: %v", err)
}
gotHash := u.Hash()

expectHashString := "1c6fb6f3684bafb0c173d8b8b957ceff031180c1"
rehashed, err := HashFromHexString(expectHashString)
if err != nil {
t.Fatalf("HashFromHexString failed with: %v", err)
Expand Down

0 comments on commit bbea486

Please sign in to comment.