Debian Codegraph @

go/analysis/passes/stringintconv/testdata/src/a/a.go

raw symbols SCIP
1 // Copyright 2020 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 // This file contains tests for the stringintconv checker.
6
7 package a
8
9 type A string
10
11 type B = string
12
13 type C int
14
15 type D = uintptr
16
17 func StringTest() {
18 var (
19 i int
20 j rune
21 k byte
22 l C
23 m D
24 n = []int{0, 1, 2}
25 o struct{ x int }
26 )
27 const p = 0
28 // First time only, assert the complete message:
29 _ = string(i) // want `^conversion from int to string yields a string of one rune, not a string of digits$`
30 _ = string(j)
31 _ = string(k)
32 _ = string(p) // want `...from untyped int to string...`
33 _ = A(l) // want `...from C \(int\) to A \(string\)...`
34 _ = B(m) // want `...from (uintptr|D \(uintptr\)) to B \(string\)...`
35 _ = string(n[1]) // want `...from int to string...`
36 _ = string(o.x) // want `...from int to string...`
37 }