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>
This commit is contained in:
Johannes Sixt 2014-03-21 22:07:20 +01:00 committed by Junio C Hamano
parent ad5070fb36
commit 02907a08cc
9 changed files with 55 additions and 0 deletions

4
t/t4018/cpp-c++-function Normal file
View file

@ -0,0 +1,4 @@
Item RIGHT::DoSomething( Args with_spaces )
{
ChangeMe;
}

View file

@ -0,0 +1,4 @@
class RIGHT
{
int ChangeMe;
};

View file

@ -0,0 +1,5 @@
class RIGHT :
public Baseclass
{
int ChangeMe;
};

View file

@ -0,0 +1,4 @@
const char *get_it_RIGHT(char *ptr)
{
ChangeMe;
}

View file

@ -0,0 +1,8 @@
class RIGHT : public Baseclass
{
public:
protected:
private:
void DoSomething();
int ChangeMe;
};

View file

@ -0,0 +1,9 @@
struct item RIGHT(int i)
// Do not
// pick up
/* these
** comments.
*/
{
ChangeMe;
}

8
t/t4018/cpp-skip-labels Normal file
View file

@ -0,0 +1,8 @@
void RIGHT (void)
{
repeat: // C++ comment
next: /* C comment */
do_something();
ChangeMe;
}

View file

@ -0,0 +1,9 @@
struct RIGHT {
unsigned
/* this bit field looks like a label and should not be picked up */
decoy_bitfield: 2,
more : 1;
int filler;
int ChangeMe;
};

View file

@ -0,0 +1,4 @@
void RIGHT (void)
{
ChangeMe;
}