package testpkg

func fn0() {
	a := 1
	switch a {
	case 1:
	case 2:
		panic(a)
	}
}

func fn1() {
	a := 1
	b := 2 // want `missing whitespace above this line \(too many statements above switch\)`
	switch b {
	case 1:
	case 2:
	case 3:
		panic(a)
	}
}

func fn2() {
	b := 2
	a := 1
	switch b { // want `missing whitespace above this line \(no shared variables above switch\)`
	case 1:
	case 2:
	case 3:
		panic(a)
	}
}

func fn3() {
	switch true {
	case true:
	case false:
	}
	switch true { // want `missing whitespace above this line \(invalid statement above switch\)`
	case true:
	case false:
		panic("")
	}
}

func fn4() {
	timeout := 10
	switch timeout {
	case 5:
		timeout = 100
	case 10:
		timeout = 0
	}
}

func fn5() {
	timeout := 10
	switch {
	case timeout > 5:
		timeout = 100
	case timeout == 10:
		timeout = 0
	}

	timeout2 := 20
	timeout3 := 30 // want `missing whitespace above this line \(too many statements above switch\)`
	switch {
	case timeout2 > 5:
		timeout = 100
	case timeout3 == 10:
		timeout = 0
	}
}

func fn6(a, b int) {
	n := 1
	switch { // want `missing whitespace above this line \(no shared variables above switch\)`
	case a > b:
		_ = n
	case b > a:
		_ = n
	default:
		_ = n
	}
}
