mirror of
https://github.com/mgechev/revive.git
synced 2025-11-23 22:04:49 +02:00
refactor: rename files to follow Go convention
This commit is contained in:
committed by
chavacava
parent
c0d4d07ab6
commit
be95bfa705
60
testdata/unreachable_code.go
vendored
Normal file
60
testdata/unreachable_code.go
vendored
Normal file
@@ -0,0 +1,60 @@
|
||||
package fixtures
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func foo() int {
|
||||
log.Fatalf("%s", "About to fail") // ignore
|
||||
return 0 // MATCH /unreachable code after this statement/
|
||||
return 1
|
||||
Println("unreachable")
|
||||
}
|
||||
|
||||
func f() {
|
||||
fmt.Println("Hello, playground")
|
||||
if true {
|
||||
return // MATCH /unreachable code after this statement/
|
||||
Println("unreachable")
|
||||
os.Exit(2) // ignore
|
||||
Println("also unreachable")
|
||||
}
|
||||
return // MATCH /unreachable code after this statement/
|
||||
fmt.Println("Bye, playground")
|
||||
}
|
||||
|
||||
func g() {
|
||||
fmt.Println("Hello, playground")
|
||||
if true {
|
||||
return // ignore if next stmt is labeled
|
||||
label:
|
||||
os.Exit(2) // ignore
|
||||
}
|
||||
|
||||
fmt.Println("Bye, playground")
|
||||
}
|
||||
|
||||
func TestA(t *testing.T) {
|
||||
tests := make([]int, 100)
|
||||
for i := range tests {
|
||||
println("i: ", i)
|
||||
if i == 0 {
|
||||
t.Fatal("i == 0") // MATCH /unreachable code after this statement/
|
||||
println("unreachable")
|
||||
continue
|
||||
}
|
||||
if i == 1 {
|
||||
t.Fatalf("i:%d", i) // MATCH /unreachable code after this statement/
|
||||
println("unreachable")
|
||||
continue
|
||||
}
|
||||
if i == 2 {
|
||||
t.FailNow() // MATCH /unreachable code after this statement/
|
||||
println("unreachable")
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user