From 9de076dd64869304d8e455ff0f7d2df58ade5384 Mon Sep 17 00:00:00 2001 From: Carlos A Becker Date: Wed, 9 Feb 2022 21:18:13 -0300 Subject: [PATCH] test: improve test a bit refs #24 --- glob_test.go | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/glob_test.go b/glob_test.go index 188fc3c..d899247 100644 --- a/glob_test.go +++ b/glob_test.go @@ -458,23 +458,26 @@ func TestGlob(t *testing.T) { // nolint:funlen fsPath = testFS.Path() } - workingSymlink := filepath.Join(fsPath, "b") - brokenSymlink := filepath.Join(fsPath, "c") - err := os.Symlink("a", workingSymlink) - require.NoError(t, err) - err = os.Symlink("non-existent", brokenSymlink) - require.NoError(t, err) - - matches, err := Glob(workingSymlink) - require.NoError(t, err) - require.Equal(t, []string{ - workingSymlink, - }, matches) - matches, err = Glob(brokenSymlink) - require.NoError(t, err) - require.Equal(t, []string{ - brokenSymlink, - }, matches) + t.Run("good", func(t *testing.T) { + workingSymlink := filepath.Join(fsPath, "b") + require.NoError(t, os.Symlink("a", workingSymlink)) + matches, err := Glob(workingSymlink) + require.NoError(t, err) + require.Equal(t, []string{ + workingSymlink, + }, matches) + }) + + t.Run("broken", func(t *testing.T) { + brokenSymlink := filepath.Join(fsPath, "c") + require.NoError(t, os.Symlink("non-existent", brokenSymlink)) + + matches, err := Glob(brokenSymlink) + require.NoError(t, err) + require.Equal(t, []string{ + brokenSymlink, + }, matches) + }) }) }