mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-06-10 14:58:10 -05:00
Add base for menu parsing unit tests
This commit is contained in:
36
test/ParserTestUtils/Parsing/Mock/MockParserLineStream.h
Normal file
36
test/ParserTestUtils/Parsing/Mock/MockParserLineStream.h
Normal file
@ -0,0 +1,36 @@
|
||||
#pragma once
|
||||
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Parsing/IParserLineStream.h"
|
||||
|
||||
class MockParserLineStream final : public IParserLineStream
|
||||
{
|
||||
public:
|
||||
static const std::string MOCK_FILENAME;
|
||||
|
||||
private:
|
||||
class IncludePos
|
||||
{
|
||||
public:
|
||||
std::string m_filename;
|
||||
const std::vector<std::string>& m_lines;
|
||||
unsigned m_pos;
|
||||
|
||||
IncludePos(std::string filename, const std::vector<std::string>& lines);
|
||||
};
|
||||
|
||||
std::unordered_map<std::string, std::vector<std::string>> m_include_lines;
|
||||
std::vector<IncludePos> m_include_positions;
|
||||
|
||||
public:
|
||||
explicit MockParserLineStream(const std::vector<std::string>& lines);
|
||||
|
||||
void AddIncludeLines(const std::string& filename, const std::vector<std::string>& lines);
|
||||
ParserLine NextLine() override;
|
||||
bool IncludeFile(const std::string& filename) override;
|
||||
void PopCurrentFile() override;
|
||||
_NODISCARD bool IsOpen() const override;
|
||||
_NODISCARD bool Eof() const override;
|
||||
};
|
Reference in New Issue
Block a user