mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
* Support include import configuration * Remove support for regular rules * Remove support for regular rules * Fix configuration file parsing bug * Added utest tests for include functionality * Added utest tests for include functionality * Modify the UTest function * optimized code * Config: Refine parse error with state * Config: Reorder functions * Config: Rename parsing type to context * Config: Refine args for include * Config: Add utests for include * Config: Refine code, parsing recursively. * Config: Change the mock from file to buffer * Config: Mock buffer in config * Config: Refine code * Add utests for include * Added utest for include Co-authored-by: pengfei.ma <pengfei.ma@ngaa.com.cn> Co-authored-by: winlin <winlin@vip.126.com>
45 lines
966 B
C++
45 lines
966 B
C++
//
|
|
// Copyright (c) 2013-2021 The SRS Authors
|
|
//
|
|
// SPDX-License-Identifier: MIT or MulanPSL-2.0
|
|
//
|
|
|
|
#ifndef SRS_UTEST_CONFIG_HPP
|
|
#define SRS_UTEST_CONFIG_HPP
|
|
|
|
/*
|
|
#include <srs_utest_config.hpp>
|
|
*/
|
|
#include <srs_utest.hpp>
|
|
|
|
#include <string>
|
|
|
|
#include <srs_app_config.hpp>
|
|
|
|
#define _MIN_OK_CONF "listen 1935; "
|
|
|
|
class MockSrsConfigBuffer : public srs_internal::SrsConfigBuffer
|
|
{
|
|
public:
|
|
MockSrsConfigBuffer(std::string buf);
|
|
virtual ~MockSrsConfigBuffer();
|
|
public:
|
|
virtual srs_error_t fullfill(const char* filename);
|
|
};
|
|
|
|
class MockSrsConfig : public SrsConfig
|
|
{
|
|
public:
|
|
MockSrsConfig();
|
|
virtual ~MockSrsConfig();
|
|
private:
|
|
std::map<std::string, std::string> included_files;
|
|
public:
|
|
virtual srs_error_t parse(std::string buf);
|
|
virtual srs_error_t mock_include(const std::string file_name, const std::string content);
|
|
protected:
|
|
virtual srs_error_t build_buffer(std::string src, srs_internal::SrsConfigBuffer** pbuffer);
|
|
};
|
|
|
|
#endif
|
|
|