t4018: test cases for the built-in cpp pattern

A later patch changes the built-in cpp pattern. These test cases demonstrate aspects of the pattern that we do not want to change. Signed-off-by: Johannes Sixt <j6t@kdbg.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Sixt committed Mar 21, 2014 at 22:07 UTC 02907a08ccfbdf0a9a48259fd7e9a234f3c123b3
9 files changed +55
t/t4018/cpp-c++-function new
+4
@@ -0,0 +1,4 @@
1 +Item RIGHT::DoSomething( Args with_spaces )
2 +{
3 + ChangeMe;
4 +}
t/t4018/cpp-class-definition new
+4
@@ -0,0 +1,4 @@
1 +class RIGHT
2 +{
3 + int ChangeMe;
4 +};
t/t4018/cpp-class-definition-derived new
+5
@@ -0,0 +1,5 @@
1 +class RIGHT :
2 + public Baseclass
3 +{
4 + int ChangeMe;
5 +};
t/t4018/cpp-function-returning-pointer new
+4
@@ -0,0 +1,4 @@
1 +const char *get_it_RIGHT(char *ptr)
2 +{
3 + ChangeMe;
4 +}
t/t4018/cpp-skip-access-specifiers new
+8
@@ -0,0 +1,8 @@
1 +class RIGHT : public Baseclass
2 +{
3 +public:
4 +protected:
5 +private:
6 + void DoSomething();
7 + int ChangeMe;
8 +};
t/t4018/cpp-skip-comment-block new
+9
@@ -0,0 +1,9 @@
1 +struct item RIGHT(int i)
2 +// Do not
3 +// pick up
4 +/* these
5 +** comments.
6 +*/
7 +{
8 + ChangeMe;
9 +}
t/t4018/cpp-skip-labels new
+8
@@ -0,0 +1,8 @@
1 +void RIGHT (void)
2 +{
3 +repeat: // C++ comment
4 +next: /* C comment */
5 + do_something();
6 +
7 + ChangeMe;
8 +}
t/t4018/cpp-struct-definition new
+9
@@ -0,0 +1,9 @@
1 +struct RIGHT {
2 + unsigned
3 + /* this bit field looks like a label and should not be picked up */
4 + decoy_bitfield: 2,
5 + more : 1;
6 + int filler;
7 +
8 + int ChangeMe;
9 +};
t/t4018/cpp-void-c-function new
+4
@@ -0,0 +1,4 @@
1 +void RIGHT (void)
2 +{
3 + ChangeMe;
4 +}