diff options
author | Tao Bao <tbao@google.com> | 2016-10-13 19:38:14 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-10-13 19:38:14 +0200 |
commit | bd16939bbf182a66270e8f28d86762400b89eaff (patch) | |
tree | 5bf4296cdf061cbe1c77c2ed35cf5ea64f2fe232 /tests/component | |
parent | Merge "updater: Kill the duplicate PrintSha1() in install.cpp." am: 19bb05dfc7 (diff) | |
parent | Merge "edify: Some clean-ups to libedify." (diff) | |
download | android_bootable_recovery-bd16939bbf182a66270e8f28d86762400b89eaff.tar android_bootable_recovery-bd16939bbf182a66270e8f28d86762400b89eaff.tar.gz android_bootable_recovery-bd16939bbf182a66270e8f28d86762400b89eaff.tar.bz2 android_bootable_recovery-bd16939bbf182a66270e8f28d86762400b89eaff.tar.lz android_bootable_recovery-bd16939bbf182a66270e8f28d86762400b89eaff.tar.xz android_bootable_recovery-bd16939bbf182a66270e8f28d86762400b89eaff.tar.zst android_bootable_recovery-bd16939bbf182a66270e8f28d86762400b89eaff.zip |
Diffstat (limited to '')
-rw-r--r-- | tests/component/edify_test.cpp | 28 | ||||
-rw-r--r-- | tests/component/updater_test.cpp | 1 |
2 files changed, 23 insertions, 6 deletions
diff --git a/tests/component/edify_test.cpp b/tests/component/edify_test.cpp index ede2ecb0a..a4dbb9fbe 100644 --- a/tests/component/edify_test.cpp +++ b/tests/component/edify_test.cpp @@ -22,17 +22,18 @@ static void expect(const char* expr_str, const char* expected) { Expr* e; - int error_count; - EXPECT_EQ(parse_string(expr_str, &e, &error_count), 0); + int error_count = 0; + EXPECT_EQ(0, parse_string(expr_str, &e, &error_count)); + EXPECT_EQ(0, error_count); State state(expr_str, nullptr); char* result = Evaluate(&state, e); if (expected == nullptr) { - EXPECT_EQ(result, nullptr); + EXPECT_EQ(nullptr, result); } else { - EXPECT_STREQ(result, expected); + EXPECT_STREQ(expected, result); } free(result); @@ -42,7 +43,6 @@ class EdifyTest : public ::testing::Test { protected: virtual void SetUp() { RegisterBuiltins(); - FinishRegistration(); } }; @@ -149,3 +149,21 @@ TEST_F(EdifyTest, big_string) { expect(std::string(8192, 's').c_str(), std::string(8192, 's').c_str()); } +TEST_F(EdifyTest, unknown_function) { + // unknown function + const char* script1 = "unknown_function()"; + Expr* expr; + int error_count = 0; + EXPECT_EQ(1, parse_string(script1, &expr, &error_count)); + EXPECT_EQ(1, error_count); + + const char* script2 = "abc; unknown_function()"; + error_count = 0; + EXPECT_EQ(1, parse_string(script2, &expr, &error_count)); + EXPECT_EQ(1, error_count); + + const char* script3 = "unknown_function1() || yes"; + error_count = 0; + EXPECT_EQ(1, parse_string(script3, &expr, &error_count)); + EXPECT_EQ(1, error_count); +} diff --git a/tests/component/updater_test.cpp b/tests/component/updater_test.cpp index bd6534b3b..64a6b37ce 100644 --- a/tests/component/updater_test.cpp +++ b/tests/component/updater_test.cpp @@ -54,7 +54,6 @@ class UpdaterTest : public ::testing::Test { virtual void SetUp() { RegisterBuiltins(); RegisterInstallFunctions(); - FinishRegistration(); } }; |