diff options
author | Tao Bao <tbao@google.com> | 2018-07-09 19:38:40 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-07-09 19:38:40 +0200 |
commit | c059b6c1c66d802196874b1ad14c62f33774a87a (patch) | |
tree | 0300e0c2d1f901f89d35f93f791174d6693b1296 /tests/unit | |
parent | Merge "tests: Split unit tests out of component/applypatch_test.cpp." (diff) | |
parent | updater: Add ABORT command. (diff) | |
download | android_bootable_recovery-c059b6c1c66d802196874b1ad14c62f33774a87a.tar android_bootable_recovery-c059b6c1c66d802196874b1ad14c62f33774a87a.tar.gz android_bootable_recovery-c059b6c1c66d802196874b1ad14c62f33774a87a.tar.bz2 android_bootable_recovery-c059b6c1c66d802196874b1ad14c62f33774a87a.tar.lz android_bootable_recovery-c059b6c1c66d802196874b1ad14c62f33774a87a.tar.xz android_bootable_recovery-c059b6c1c66d802196874b1ad14c62f33774a87a.tar.zst android_bootable_recovery-c059b6c1c66d802196874b1ad14c62f33774a87a.zip |
Diffstat (limited to 'tests/unit')
-rw-r--r-- | tests/unit/commands_test.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/tests/unit/commands_test.cpp b/tests/unit/commands_test.cpp index cb2be9176..3daa58f33 100644 --- a/tests/unit/commands_test.cpp +++ b/tests/unit/commands_test.cpp @@ -159,6 +159,27 @@ TEST(CommandsTest, Parse_EmptyInput) { ASSERT_EQ("invalid type", err); } +TEST(CommandsTest, Parse_ABORT_Allowed) { + Command::abort_allowed_ = true; + + const std::string input{ "abort" }; + std::string err; + Command command = Command::Parse(input, 0, &err); + ASSERT_TRUE(command); + + ASSERT_EQ(TargetInfo(), command.target()); + ASSERT_EQ(SourceInfo(), command.source()); + ASSERT_EQ(StashInfo(), command.stash()); + ASSERT_EQ(PatchInfo(), command.patch()); +} + +TEST(CommandsTest, Parse_ABORT_NotAllowed) { + const std::string input{ "abort" }; + std::string err; + Command command = Command::Parse(input, 0, &err); + ASSERT_FALSE(command); +} + TEST(CommandsTest, Parse_BSDIFF) { const std::string input{ "bsdiff 0 148 " @@ -312,9 +333,12 @@ TEST(CommandsTest, Parse_ZERO) { } TEST(CommandsTest, Parse_InvalidNumberOfArgs) { + Command::abort_allowed_ = true; + // Note that the case of having excess args in BSDIFF, IMGDIFF and MOVE is covered by // ParseTargetInfoAndSourceInfo_InvalidInput. std::vector<std::string> inputs{ + "abort foo", "bsdiff", "erase", "erase 4,3,5,10,12 hash1", |