Run executables directly (#645)
- Apps can be launched directly from file paths (including Files app support) - Added executable detection to identify unsupported or invalid binaries before launch. - App startup is now streamlined through separate registered-app and direct-execution interfaces. - Existing app launch points were migrated to the updated startup APIs.
This commit is contained in:
committed by
GitHub
parent
643cbc3806
commit
a0b2ee7ebc
@@ -0,0 +1,40 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
#include "doctest.h"
|
||||
|
||||
#include <app/private/arguments.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
TEST_CASE("app_arguments_copy returns NULL for argc <= 0") {
|
||||
const char* const argv[] = { "a" };
|
||||
CHECK_EQ(app_arguments_copy(0, argv), nullptr);
|
||||
CHECK_EQ(app_arguments_copy(-1, argv), nullptr);
|
||||
CHECK_EQ(app_arguments_copy(0, nullptr), nullptr);
|
||||
}
|
||||
|
||||
TEST_CASE("app_arguments_copy deep-copies argv") {
|
||||
const char* const argv[] = { "one", "two", "three" };
|
||||
char** copy = app_arguments_copy(3, argv);
|
||||
REQUIRE_NE(copy, nullptr);
|
||||
|
||||
CHECK_NE(static_cast<const void*>(copy[0]), static_cast<const void*>(argv[0]));
|
||||
CHECK_EQ(std::strcmp(copy[0], "one"), 0);
|
||||
CHECK_EQ(std::strcmp(copy[1], "two"), 0);
|
||||
CHECK_EQ(std::strcmp(copy[2], "three"), 0);
|
||||
CHECK_EQ(copy[3], nullptr);
|
||||
|
||||
app_arguments_free(3, copy);
|
||||
}
|
||||
|
||||
TEST_CASE("app_arguments_copy handles an empty string argument") {
|
||||
const char* const argv[] = { "" };
|
||||
char** copy = app_arguments_copy(1, argv);
|
||||
REQUIRE_NE(copy, nullptr);
|
||||
CHECK_EQ(std::strcmp(copy[0], ""), 0);
|
||||
CHECK_EQ(copy[1], nullptr);
|
||||
app_arguments_free(1, copy);
|
||||
}
|
||||
|
||||
TEST_CASE("app_arguments_free is a no-op for count 0 / null values") {
|
||||
app_arguments_free(0, nullptr);
|
||||
}
|
||||
Reference in New Issue
Block a user