Make clearer assertions about SpyInput's read strings

This commit is contained in:
Max Brunsfeld 2017-03-21 12:14:04 -07:00
parent ca943f09a4
commit a15e974150
4 changed files with 31 additions and 10 deletions

View file

@ -94,7 +94,7 @@ describe("Document", [&]() {
ts_document_set_input(document, spy_input->input());
AssertThat(ts_document_root_node(document), Equals<TSNode>(root));
AssertThat(ts_node_has_changes(root), IsFalse());
AssertThat(spy_input->strings_read, Equals(vector<string>({ "" })));
AssertThat(spy_input->strings_read(), IsEmpty());
});
it("reads text from the new input for future parses", [&]() {
@ -113,7 +113,7 @@ describe("Document", [&]() {
assert_node_string_equals(
new_root,
"(object (pair (string) (array (null) (number))))");
AssertThat(spy_input->strings_read, Equals(vector<string>({" [null, 2" })));
AssertThat(spy_input->strings_read(), Equals(vector<string>({" [null, 2" })));
});
it("allows setting input string with length", [&]() {

View file

@ -254,7 +254,7 @@ describe("Parser", [&]() {
"(identifier) "
"(math_op (number) (member_access (identifier) (identifier))))))");
AssertThat(input->strings_read, Equals(vector<string>({ " + abc.d)" })));
AssertThat(input->strings_read(), Equals(vector<string>({ " abc.d);" })));
});
});
@ -279,7 +279,7 @@ describe("Parser", [&]() {
"(number) "
"(math_op (number) (math_op (number) (identifier)))))))");
AssertThat(input->strings_read, Equals(vector<string>({ "123 || 5 +" })));
AssertThat(input->strings_read(), Equals(vector<string>({"123 || 5 ", ";"})));
});
});