From 0b5559336ef427b0bda3b96096bc19c714a813e5 Mon Sep 17 00:00:00 2001 From: surtur Date: Tue, 31 May 2022 21:07:44 +0200 Subject: [PATCH] cmd(version): check for more errors in the test --- cmd/version_test.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/version_test.go b/cmd/version_test.go index 71903eb..09ffde6 100644 --- a/cmd/version_test.go +++ b/cmd/version_test.go @@ -5,6 +5,7 @@ package cmd import ( "bytes" + "errors" "os" "regexp" "testing" @@ -17,7 +18,11 @@ func TestNixFlake_GosrcVersionStringEquivalence(t *testing.T) { fData, err := os.ReadFile("../flake.nix") if err != nil { - t.Errorf("Failed to open flake.nix: %q", err) + if errors.Is(err, os.ErrNotExist) { + t.Errorf("Failed to open flake.nix: %q", err) + } + + t.Errorf("Error reading flake: %q", err) } got := bytes.Contains(fData, []byte(" version = \""+want+"\""))