From cc0406520750c2e20386ffc01a4151a86af4fff8 Mon Sep 17 00:00:00 2001 From: Jan Travnicek <Jan.Travnicek@fit.cvut.cz> Date: Sat, 28 Dec 2019 21:08:06 +0100 Subject: [PATCH] move cli test line to common file --- alib2cli/test-src/cli/CliTest.cpp | 8 +------- alib2cli/test-src/cli/common/TestLine.cpp | 10 ++++++++++ alib2cli/test-src/cli/common/TestLine.hpp | 4 ++++ 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 alib2cli/test-src/cli/common/TestLine.cpp create mode 100644 alib2cli/test-src/cli/common/TestLine.hpp diff --git a/alib2cli/test-src/cli/CliTest.cpp b/alib2cli/test-src/cli/CliTest.cpp index e427cbd281..054f1d0785 100644 --- a/alib2cli/test-src/cli/CliTest.cpp +++ b/alib2cli/test-src/cli/CliTest.cpp @@ -2,17 +2,11 @@ #include <alib/iostream> -#include <lexer/Lexer.h> -#include <parser/Parser.h> - #include <sys/stat.h> #include <registry/AlgorithmRegistry.hpp> #include <registration/AlgoRegistration.hpp> -#include <readline/StringLineInterface.h> -void testLine ( std::string line, cli::Environment & environment ) { - cli::Parser ( cli::Lexer ( cli::CharSequence ( cli::StringLineInterface ( line ) ) ) ).parse ( )->run ( environment ); -} +#include "common/TestLine.hpp" class Foo { int m_base; diff --git a/alib2cli/test-src/cli/common/TestLine.cpp b/alib2cli/test-src/cli/common/TestLine.cpp new file mode 100644 index 0000000000..306c62b620 --- /dev/null +++ b/alib2cli/test-src/cli/common/TestLine.cpp @@ -0,0 +1,10 @@ +#include "TestLine.hpp" + +#include <lexer/Lexer.h> +#include <parser/Parser.h> + +#include <readline/StringLineInterface.h> + +void testLine ( std::string line, cli::Environment & environment ) { + cli::Parser ( cli::Lexer ( cli::CharSequence ( cli::StringLineInterface ( line ) ) ) ).parse ( )->run ( environment ); +} diff --git a/alib2cli/test-src/cli/common/TestLine.hpp b/alib2cli/test-src/cli/common/TestLine.hpp new file mode 100644 index 0000000000..b9b2163915 --- /dev/null +++ b/alib2cli/test-src/cli/common/TestLine.hpp @@ -0,0 +1,4 @@ +#include <environment/Environment.h> +#include <string> + +void testLine ( std::string line, cli::Environment & environment ); -- GitLab