xaizek / zograscope (License: AGPLv3 only) (since 2018-12-07)
Mainly a syntax-aware diff that also provides a number of additional tools.
Commit 0295dd67acd015924408bdbd19b6da209162e920

Add test for "else if" keyword recognition in C++
Author: xaizek
Author date (UTC): 2020-03-29 22:18
Committer name: xaizek
Committer date (UTC): 2020-03-29 22:18
Parent(s): ec216ae4ff83a95c7b21e6c680d3a4904d8e406e
Signing key: 99DC5E4DB05F6BE2
Tree: 33ee46dfdd5c89e00a1798fe36769bb0badf08fe
File Lines added Lines deleted
tests/srcml/cxx/srcml-cxx-parser.cpp 16 0
File tests/srcml/cxx/srcml-cxx-parser.cpp changed (mode: 100644) (index d1cf74f..a76f9b6)
... ... TEST_CASE("Keywords are marked with types", "[.srcml][srcml-cxx][parser]")
144 144 CHECK(findNode(tree, makePred(Type::Keywords, "switch")) != nullptr); CHECK(findNode(tree, makePred(Type::Keywords, "switch")) != nullptr);
145 145 CHECK(findNode(tree, makePred(Type::Keywords, "default")) != nullptr); CHECK(findNode(tree, makePred(Type::Keywords, "default")) != nullptr);
146 146 CHECK(findNode(tree, makePred(Type::Keywords, "break")) != nullptr); CHECK(findNode(tree, makePred(Type::Keywords, "break")) != nullptr);
147
148 tree = parseCxx(R"(
149 void f() {
150 if (0) {
151 } else if (this) {
152 }
153 }
154 )");
155 CHECK(findNode(tree, makePred(Type::Keywords, "else")) != nullptr);
156 CHECK(findNode(tree, makePred(Type::Keywords, "this")) != nullptr);
157 auto test = [](const Node *node) {
158 return node->label == "if"
159 && node->type == Type::Keywords
160 && node->line == 4;
161 };
162 CHECK(findNode(tree, test) != nullptr);
147 163 } }
148 164
149 165 TEST_CASE("this is recognized as a keyword", "[.srcml][srcml-cxx][parser]") TEST_CASE("this is recognized as a keyword", "[.srcml][srcml-cxx][parser]")
Hints

Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://code.reversed.top/user/xaizek/zograscope

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@code.reversed.top/user/xaizek/zograscope

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a pull request:
... clone the repository ...
... make some changes and some commits ...
git push origin master