diff --git a/unit/unit_test.go b/unit/unit_test.go index cc52a8fe2..256ff14a3 100644 --- a/unit/unit_test.go +++ b/unit/unit_test.go @@ -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)