1// run
2
3// Copyright 2016 The Go Authors. All rights reserved.
4// Use of this source code is governed by a BSD-style
5// license that can be found in the LICENSE file.
6
7// Verify that //line directives with filenames
8// containing ':' (Windows) are correctly parsed.
9// (For a related issue, see test/fixedbugs/bug305.go)
10
11package main
12
13import (
14	"fmt"
15	"runtime"
16)
17
18func check(file string, line int) {
19	_, f, l, ok := runtime.Caller(1)
20	if !ok {
21		panic("runtime.Caller(1) failed")
22	}
23	if f != file || l != line {
24		panic(fmt.Sprintf("got %s:%d; want %s:%d", f, l, file, line))
25	}
26}
27
28func main() {
29//line /foo/bar.go:123
30	check(`/foo/bar.go`, 123)
31//line c:/foo/bar.go:987
32	check(`c:/foo/bar.go`, 987)
33}
34