mirror of
https://github.com/aseprite/aseprite.git
synced 2024-11-20 14:21:45 +00:00
Fix crash of cli_tests using copies of AppOptions instances
This commit is contained in:
parent
d5e167fc37
commit
52d4818196
@ -96,6 +96,8 @@ public:
|
||||
#endif
|
||||
|
||||
private:
|
||||
AppOptions(const AppOptions& that);
|
||||
|
||||
std::string m_exeName;
|
||||
base::ProgramOptions m_po;
|
||||
bool m_startUI;
|
||||
|
@ -52,7 +52,7 @@ private:
|
||||
bool m_batchMode;
|
||||
};
|
||||
|
||||
AppOptions args(std::initializer_list<const char*> l) {
|
||||
std::unique_ptr<AppOptions> args(std::initializer_list<const char*> l) {
|
||||
int argc = l.size()+1;
|
||||
const char** argv = new const char*[argc];
|
||||
argv[0] = "aseprite.exe";
|
||||
@ -61,7 +61,7 @@ AppOptions args(std::initializer_list<const char*> l) {
|
||||
argv[i] = *it;
|
||||
TRACE("argv[%d] = %s\n", i, argv[i]);
|
||||
}
|
||||
AppOptions opts(argc, argv);
|
||||
std::unique_ptr<AppOptions> opts(new AppOptions(argc, argv));
|
||||
delete[] argv;
|
||||
return opts;
|
||||
}
|
||||
@ -69,8 +69,8 @@ AppOptions args(std::initializer_list<const char*> l) {
|
||||
TEST(Cli, None)
|
||||
{
|
||||
CliTestDelegate d;
|
||||
AppOptions a = args({ });
|
||||
CliProcessor p(&d, a);
|
||||
auto a = args({ });
|
||||
CliProcessor p(&d, *a);
|
||||
p.process(nullptr);
|
||||
EXPECT_TRUE(!d.helpWasShown());
|
||||
EXPECT_TRUE(!d.versionWasShown());
|
||||
@ -79,8 +79,8 @@ TEST(Cli, None)
|
||||
TEST(Cli, Help)
|
||||
{
|
||||
CliTestDelegate d;
|
||||
AppOptions a = args({ "--help" });
|
||||
CliProcessor p(&d, a);
|
||||
auto a = args({ "--help" });
|
||||
CliProcessor p(&d, *a);
|
||||
p.process(nullptr);
|
||||
EXPECT_TRUE(d.helpWasShown());
|
||||
}
|
||||
@ -88,8 +88,8 @@ TEST(Cli, Help)
|
||||
TEST(Cli, Version)
|
||||
{
|
||||
CliTestDelegate d;
|
||||
AppOptions a = args({ "--version" });
|
||||
CliProcessor p(&d, a);
|
||||
auto a = args({ "--version" });
|
||||
CliProcessor p(&d, *a);
|
||||
p.process(nullptr);
|
||||
EXPECT_TRUE(d.versionWasShown());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user