// Verify that comments of the form "//line filename:line" are interpreted correctly.

Verify that comments of the form "//line filename:line" are interpreted correctly.
// Verify that comments of the form " // line filename : line " are interpreted correctly .
func TestLineComments(t *testing.T) {
	segs := segments
	if runtime.GOOS == "windows" {
		segs = append(segs, winsegments...)
	} else {
		segs = append(segs, unixsegments...)
	}
	var src string
	for _, e := range segs {
		src += e.srcline
	}
	var S Scanner
	file := fset.AddFile(filepath.Join("dir", "TestLineComments"), fset.Base(), len(src))
	S.Init(file, []byte(src), nil, 0)
	for _, s := range segs {
		p, _, lit := S.Scan()
		pos := file.Position(p)
		checkPos(t, lit, p, token.Position{s.filename, pos.Offset, s.line, pos.Column})
	}
	if S.ErrorCount != 0 {
		t.Errorf("found %d errors", S.ErrorCount)
	}
}
func TestLineComments ( t * testing . T ) { segs := segments if runtime . GOOS == " " { segs = append ( segs , winsegments ... ) } else { segs = append ( segs , unixsegments ... ) } var src string for _ , e := range segs { src += e . srcline } var S Scanner file := fset . AddFile ( filepath . Join ( " " , " " ) , fset . Base ( ) , len ( src ) ) S . Init ( file , [ ] byte ( src ) , nil , 0 ) for _ , s := range segs { p , _ , lit := S . Scan ( ) pos := file . Position ( p ) checkPos ( t , lit , p , token . Position { s . filename , pos . Offset , s . line , pos . Column } ) } if S . ErrorCount != 0 { t . Errorf ( " " , S . ErrorCount ) } }
Verify that comments of the form "//line filename:line" are interpreted correctly.
Verify that comments of the form " // line filename : line " are interpreted correctly .
// make source
 // verify scan
