Add tests.

This commit is contained in:
David Anderson 2014-07-04 17:01:12 -07:00
parent 49eee8c04e
commit dfa9a8f134
4 changed files with 74 additions and 4 deletions

View File

@ -3347,12 +3347,9 @@ static int reparse_new_decl(declinfo_t *decl, int flags)
if (matchtoken('['))
parse_old_array_dims(decl, flags);
} else {
// No post-dimensions means anything here is part of the type.
if (matchtoken('[')) {
if (decl->type.numdim > 0) {
if (lexpeek('['))
if (decl->type.numdim > 0)
error(121);
}
parse_old_array_dims(decl, flags);
} else if (decl->type.numdim) {
// Reset dimension sizes.

View File

@ -0,0 +1,13 @@
native int[] egg6();
forward float[] egg7();
new void crab4;
int[] yam1 = {1,2,3}, yam2[] = {3,4,5};
forward void OnPluginStart();
public int OnPluginStart()
{
}

View File

@ -0,0 +1,5 @@
(1) : error 141: natives, forwards, and public functions cannot return arrays
(2) : error 141: natives, forwards, and public functions cannot return arrays
(3) : error 143: new-style declarations should not have "new"
(4) : error 121: cannot specify array dimensions on both type and name
(6) : error 025: function heading differs from prototype

View File

@ -0,0 +1,55 @@
native egg();
native void egg2();
native int egg3();
native bool egg4();
native bool:egg5();
new crab;
new crab2 = 5;
bool crab3 = true;
int crab4 = 6;
new crab5[] = {1, 2, 3};
bool[] crab6 = {true, false, false, true}
bool crab7[] = {false, true, true}
char crab8[] = "hello"
char[] crab9 = "bye"
native float operator*(float oper1, float oper2) = FloatMul;
forward void OnPluginStart();
public int Crab()
{
}
public float Crab2()
{
}
public Crab3()
{
}
stock char[] Crab4()
{
new String:t[5] = "egg";
return t;
}
new yam, yam2, yam3
new Float:ham, bool:ham2;
int cram, cram2, cram3;
new cram4[] = {1, 2}, cram5[] = {3, 4, 7}
int cram6[] = {1, 2}, cram7[] = {3, 4, 7}
int[] cram8 = {3, 4}, cram9 = {4, 8, 10}
public OnPluginStart()
{
new String:t[5];
t = Crab4();
cram4[0] = 2
cram5[2] = 2
cram7[2] = 2
cram8[1] = 5
cram9[2] = 5
}