From 157aeed469d45afeaf9bb13175a49867798fd2a2 Mon Sep 17 00:00:00 2001 From: Alan Donovan Date: Tue, 9 Oct 2018 10:33:47 -0400 Subject: [PATCH] go/analysis/passes/ctrlflow: add test of modularity See the Modularity section of the design doc: https://docs.google.com/document/d/1-azPLXaLgTCKeKDNg0HVMq2ovMlD-e7n1ZHzZVzOlJk#heading=h.s7mcpao0dpqu Change-Id: I83e6df01691964703a07a47c222101f3307a0dc6 Reviewed-on: https://go-review.googlesource.com/c/140759 Reviewed-by: Michael Matloob Run-TryBot: Michael Matloob --- go/analysis/passes/ctrlflow/testdata/src/a/a.go | 10 ++++++++++ go/analysis/passes/ctrlflow/testdata/src/lib/lib.go | 8 ++++++++ 2 files changed, 18 insertions(+) create mode 100644 go/analysis/passes/ctrlflow/testdata/src/lib/lib.go diff --git a/go/analysis/passes/ctrlflow/testdata/src/a/a.go b/go/analysis/passes/ctrlflow/testdata/src/a/a.go index 462aeaa8208..a65bd748158 100644 --- a/go/analysis/passes/ctrlflow/testdata/src/a/a.go +++ b/go/analysis/passes/ctrlflow/testdata/src/a/a.go @@ -8,6 +8,8 @@ import ( "runtime" "syscall" "testing" + + "lib" ) var cond bool @@ -97,3 +99,11 @@ func spurious() { // want spurious:"noReturn" } func noBody() + +func g() { + lib.CanReturn() +} + +func h() { // want h:"noReturn" + lib.NoReturn() +} diff --git a/go/analysis/passes/ctrlflow/testdata/src/lib/lib.go b/go/analysis/passes/ctrlflow/testdata/src/lib/lib.go new file mode 100644 index 00000000000..c0bf7dff483 --- /dev/null +++ b/go/analysis/passes/ctrlflow/testdata/src/lib/lib.go @@ -0,0 +1,8 @@ +package lib + +func CanReturn() {} + +func NoReturn() { + for { + } +}