mirror of
https://github.com/szymon-jozef/static-site-generator.git
synced 2026-09-07 12:10:42 +02:00
added formatter inject_html test
This commit is contained in:
11
src/tests/formatter.html
Normal file
11
src/tests/formatter.html
Normal file
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
{{replace_me}}
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "../config.hpp"
|
||||
#include "../formatter.hpp"
|
||||
#include "../markdown.hpp"
|
||||
#include "../utils.hpp"
|
||||
#include <catch2/catch_all.hpp>
|
||||
@@ -83,3 +84,22 @@ int main() {
|
||||
|
||||
REQUIRE(get_html(INPUT) == EXPECTED_OUTPUT);
|
||||
}
|
||||
|
||||
TEST_CASE("formatter injection test") {
|
||||
const std::string FILE_NAME = "./tests/formatter.html";
|
||||
const std::string EXPECTED_OUTPUT = R"(<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
</head>
|
||||
<body>
|
||||
I'm replaced!
|
||||
</body>
|
||||
</html>
|
||||
)";
|
||||
const std::string output =
|
||||
inject_html_into_template(FILE_NAME, "{{replace_me}}", "I'm replaced!");
|
||||
REQUIRE(EXPECTED_OUTPUT == output);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user