diff --git a/ql/test/library-tests/semmle/go/IR/test.expected b/ql/test/library-tests/semmle/go/IR/test.expected new file mode 100644 index 00000000000..eef7b1f4e9a --- /dev/null +++ b/ql/test/library-tests/semmle/go/IR/test.expected @@ -0,0 +1,6 @@ +| test.go:9:2:9:16 | ... := ...[0] | bool | +| test.go:9:2:9:16 | ... := ...[1] | bool | +| test.go:15:2:15:20 | ... := ...[0] | string | +| test.go:15:2:15:20 | ... := ...[1] | bool | +| test.go:21:2:21:22 | ... := ...[0] | string | +| test.go:21:2:21:22 | ... := ...[1] | bool | diff --git a/ql/test/library-tests/semmle/go/IR/test.go b/ql/test/library-tests/semmle/go/IR/test.go new file mode 100644 index 00000000000..de0d567dc3a --- /dev/null +++ b/ql/test/library-tests/semmle/go/IR/test.go @@ -0,0 +1,23 @@ +package test + +import ( + "fmt" +) + +func testChannel() { + var ch chan bool + got, ok := <-ch + fmt.Printf("%v %v", got, ok) +} + +func testMap() { + var m map[string]string + got, ok := m["key"] + fmt.Printf("%v %v", got, ok) +} + +func testTypeAssert() { + var i interface{} + got, ok := i.(string) + fmt.Printf("%v %v", got, ok) +} diff --git a/ql/test/library-tests/semmle/go/IR/test.ql b/ql/test/library-tests/semmle/go/IR/test.ql new file mode 100644 index 00000000000..1644bd5b2ef --- /dev/null +++ b/ql/test/library-tests/semmle/go/IR/test.ql @@ -0,0 +1,4 @@ +import go + +from IR::ExtractTupleElementInstruction extract +select extract, extract.getResultType()