From ff36ebcff2db169e23208bcf54d004d1421eb0db Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 28 Nov 2019 18:11:55 +0300 Subject: [PATCH] Improve test coverage for testing AST --- test/testastutils.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/testastutils.cpp b/test/testastutils.cpp index 951d21941..1d9a8e138 100644 --- a/test/testastutils.cpp +++ b/test/testastutils.cpp @@ -129,6 +129,10 @@ private: ASSERT_EQUALS(true, isReturnScope("auto f() { return [=]() { return data; }; }", -1)); ASSERT_EQUALS(true, isReturnScope("auto f() { return [=]() { return data; }(); }", -1)); ASSERT_EQUALS(false, isReturnScope("auto f() { [=]() { return data; }(); }", -1)); + + ASSERT_EQUALS(true, isReturnScope("void negativeTokenOffset() { return; }", -1)); + ASSERT_EQUALS(false, isReturnScope("void zeroTokenOffset() { return; }", 0)); + ASSERT_EQUALS(true, isReturnScope("void positiveTokenOffset() { return; }", 7)); } bool isVariableChanged(const char code[], const char startPattern[], const char endPattern[]) {