@@ -2738,7 +2738,7 @@ func getTempSymlinkPath(t *testing.T, file string) string {
27382738 t .Helper ()
27392739
27402740 tempDir := t .TempDir ()
2741- link := filepath .Join (tempDir , file + "_symlink" )
2741+ link := filepath .Join (tempDir , filepath . Base ( file ) + "_symlink" )
27422742 if err := os .Symlink (file , link ); err != nil {
27432743 t .Fatalf ("could not create temp symlink %q pointing to %q: %v" , link , file , err )
27442744 }
@@ -2787,6 +2787,62 @@ func TestNoDirExists(t *testing.T) {
27872787 True (t , NoDirExists (mockT , link ))
27882788}
27892789
2790+ func TestFileEmpty (t * testing.T ) {
2791+ t .Parallel ()
2792+
2793+ mockT := new (testing.T )
2794+ True (t , FileEmpty (mockT , filepath .Join ("testdata" , "empty_file" )))
2795+
2796+ mockT = new (testing.T )
2797+ False (t , FileEmpty (mockT , "assertions.go" ))
2798+
2799+ mockT = new (testing.T )
2800+ False (t , FileEmpty (mockT , "random_file" ))
2801+
2802+ mockT = new (testing.T )
2803+ False (t , FileEmpty (mockT , "../_codegen" ))
2804+
2805+ link := getTempSymlinkPath (t , filepath .Join ("testdata" , "empty_file" ))
2806+ mockT = new (testing.T )
2807+ True (t , FileEmpty (mockT , link ))
2808+
2809+ link = getTempSymlinkPath (t , "assertions.go" )
2810+ mockT = new (testing.T )
2811+ False (t , FileEmpty (mockT , link ))
2812+
2813+ link = getTempSymlinkPath (t , "non_existent_file" )
2814+ mockT = new (testing.T )
2815+ False (t , FileEmpty (mockT , link ))
2816+ }
2817+
2818+ func TestFileNotEmpty (t * testing.T ) {
2819+ t .Parallel ()
2820+
2821+ mockT := new (testing.T )
2822+ True (t , FileNotEmpty (mockT , "assertions.go" ))
2823+
2824+ mockT = new (testing.T )
2825+ False (t , FileNotEmpty (mockT , filepath .Join ("testdata" , "empty_file" )))
2826+
2827+ mockT = new (testing.T )
2828+ False (t , FileNotEmpty (mockT , "non_existent_file" ))
2829+
2830+ mockT = new (testing.T )
2831+ False (t , FileNotEmpty (mockT , "../_codegen" ))
2832+
2833+ link := getTempSymlinkPath (t , filepath .Join ("testdata" , "empty_file" ))
2834+ mockT = new (testing.T )
2835+ False (t , FileNotEmpty (mockT , link ))
2836+
2837+ link = getTempSymlinkPath (t , "assertions.go" )
2838+ mockT = new (testing.T )
2839+ True (t , FileNotEmpty (mockT , link ))
2840+
2841+ link = getTempSymlinkPath (t , "non_existent_file" )
2842+ mockT = new (testing.T )
2843+ False (t , NoFileExists (mockT , link ))
2844+ }
2845+
27902846func TestJSONEq_EqualSONString (t * testing.T ) {
27912847 t .Parallel ()
27922848
0 commit comments