add tests for get source location function
diff --git a/README.md b/README.md
index 57341d9..3fcb0b6 100644
--- a/README.md
+++ b/README.md
@@ -263,7 +263,7 @@
With both `trim_blocks` and `lstrip_blocks` enabled, you can put statements on their own lines. Furthermore, you can also strip whitespaces by hand. If you add a minus sign (`-`) to the start or end of a statement, the whitespaces before or after that block will be removed:
```.cpp
-render("""{% if neighbour in guests -%} I was there{% endif -%} !""", data); // Renders without any whitespaces
+render("{% if neighbour in guests -%} I was there{% endif -%} !", data); // Renders without any whitespaces
```
Stripping behind a statement also remove any newlines.
diff --git a/test/unit-renderer.cpp b/test/unit-renderer.cpp
index c2d347f..b52b469 100644
--- a/test/unit-renderer.cpp
+++ b/test/unit-renderer.cpp
@@ -457,7 +457,7 @@
}
}
-TEST_CASE("other-syntax") {
+TEST_CASE("other syntax") {
json data;
data["name"] = "Peter";
data["city"] = "Brunswick";
diff --git a/test/unit.cpp b/test/unit.cpp
index f790add..a037b0c 100644
--- a/test/unit.cpp
+++ b/test/unit.cpp
@@ -7,7 +7,33 @@
using json = nlohmann::json;
-TEST_CASE("copy-environment") {
+
+TEST_CASE("source location") {
+ std::string content = R"DELIM(Lorem Ipsum
+ Dolor
+Amid
+Set ().$
+Try this
+
+)DELIM";
+
+ CHECK(inja::get_source_location(content, 0).line == 1);
+ CHECK(inja::get_source_location(content, 0).column == 1);
+
+ CHECK(inja::get_source_location(content, 10).line == 1);
+ CHECK(inja::get_source_location(content, 10).column == 11);
+
+ CHECK(inja::get_source_location(content, 25).line == 4);
+ CHECK(inja::get_source_location(content, 25).column == 1);
+
+ CHECK(inja::get_source_location(content, 29).line == 4);
+ CHECK(inja::get_source_location(content, 29).column == 5);
+
+ CHECK(inja::get_source_location(content, 43).line == 6);
+ CHECK(inja::get_source_location(content, 43).column == 1);
+}
+
+TEST_CASE("copy environment") {
inja::Environment env;
env.add_callback("double", 1, [](inja::Arguments &args) {
int number = args.at(0)->get<int>();