-
Notifications
You must be signed in to change notification settings - Fork 250
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// Copyright (c) 2013-2023 The SRS Authors | ||
// | ||
// SPDX-License-Identifier: MIT or MulanPSL-2.0 | ||
// | ||
#include <srs_utest_config2.hpp> | ||
|
||
#include <srs_kernel_error.hpp> | ||
#include <srs_kernel_file.hpp> | ||
#include <srs_utest_kernel.hpp> | ||
|
||
VOID TEST(ConfigMainTest, CheckIncludeEmptyConfig) | ||
{ | ||
srs_error_t err; | ||
|
||
if (true) { | ||
string filepath = _srs_tmp_file_prefix + "utest-main.conf"; | ||
MockFileRemover _mfr(filepath); | ||
|
||
string included = _srs_tmp_file_prefix + "utest-included-empty.conf"; | ||
MockFileRemover _mfr2(included); | ||
|
||
if (true) { | ||
SrsFileWriter fw; | ||
fw.open(included); | ||
} | ||
|
||
if (true) { | ||
SrsFileWriter fw; | ||
fw.open(filepath); | ||
string content = _MIN_OK_CONF "include " + included + ";"; | ||
fw.write((void*)content.data(), (int)content.length(), NULL); | ||
} | ||
|
||
SrsConfig conf; | ||
HELPER_ASSERT_SUCCESS(conf.parse_file(filepath.c_str())); | ||
EXPECT_EQ(1, (int)conf.get_listens().size()); | ||
} | ||
|
||
if (true) { | ||
MockSrsConfig conf; | ||
conf.mock_include("test.conf", ""); | ||
HELPER_ASSERT_SUCCESS(conf.parse(_MIN_OK_CONF "include test.conf;")); | ||
EXPECT_EQ(1, (int)conf.get_listens().size()); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// | ||
// Copyright (c) 2013-2023 The SRS Authors | ||
// | ||
// SPDX-License-Identifier: MIT or MulanPSL-2.0 | ||
// | ||
|
||
#ifndef SRS_UTEST_CONFIG2_HPP | ||
#define SRS_UTEST_CONFIG2_HPP | ||
|
||
/* | ||
#include <srs_utest_config2.hpp> | ||
*/ | ||
#include <srs_utest_config.hpp> | ||
|
||
#endif | ||
|