Basic tests for C, C++, JavaScript and Perl

This commit is contained in:
timeless%mozdev.org 2006-09-10 10:04:07 +00:00
Родитель daf7f061fc
Коммит a0ffd230f3
4 изменённых файлов: 370 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,98 @@
#define ZIP(p, er) p = er;
#include "test.h"
#include "case/include/file.h"
#include "case/file.h"
#ifdef FOO
#else
#endif
#pragma warn
#error
#if FOO && BAR
#else if 0
#if defined(CUPID)
#endif
static int number = 1;
const char[] regexp = "/this/";
volatile char* regexpi = "/InSensitive/i";
/* simple C style comment */
(void) 1;
(void)3;
const char constant = '\3';
char single_quoted_string = 's';
char* double_quoted_string = "doubly quoted string";
char** array = {"foo", "bar"};
int* sparse_array = {1, , };
typedef int * foo;
struct X {
int y, z;
union w {
char p;
double u;
};
long:20 t:
};
typedef X XX;
void foo(void* argument, int* argument2, char &argument3,
bool argument4) {
if (condition) {
expression;
} else if (!condition2) {
expression2;
expression3;
} else {
if (other && conditions) {
!expression;
}
}
}
int exception() {
try {
throw 1;
} catch (e) {
do_something;
} finally {
return something_else;
}
return not_reached;
}
char **array3 = new char*[4];
array3[0] = "a";
array3[1] = "big";
array3[2] = "bird";
array3[3] = "can't" " fly";
int* reserved_words() {
{
for (int i = 0; i < 2; ++i);
do { nothing; } while (false);
if (!true || !!'' && " " | 3 & 7);
while (false | true & false) nothing;
int a[5];
a[3] = 0;
A qq;
qq.re = RegExp("2");
}
return(NULL);
}
void not_reserved_words() {
try();
throw();
catch();
finally();
returnThis();
var();
constThis();
new();
voidThis();
ifThis();
elseThis();
elsif;
}

Просмотреть файл

@ -0,0 +1,99 @@
#define ZIP(p, er) p = er;
#include "test.h"
#ifdef FOO
#else
#endif
#pragma warn
#error
#if FOO && BAR
#else if 0
#if defined(CUPID)
#endif
static int number = 1;
const char[] regexp = "/this/";
volatile char* regexpi = "/InSensitive/i";
/* simple C style comment */
(void) 1;
// simple C++ style comment
(void) 2;
(void)3;
const char constant = '\3';
char single_quoted_string = 's';
char* double_quoted_string = "doubly quoted string";
char** array = {"foo", "bar"};
int* sparse_array = {1, , };
void foo(void* argument, int* argument2, char &argument3,
bool argument4) {
if (condition) {
expression;
} else if (!condition2) {
expression2;
expression3;
} else {
if (other && conditions) {
!expression;
}
}
}
int exception() {
try {
throw 1;
} catch (e) {
do_something;
} finally {
return something_else;
}
return not_reached;
}
class MyClass() {
MyClass() {
_foo = 0;
}
int _foo;
int foo() {
return this->_foo++;
}
};
char **array3 = new char*[4];
array3[0] = "a";
array3[1] = "big";
array3[2] = "bird";
array3[3] = "can't" " fly";
int* reserved_words() {
try {} catch (/*e instanceof Exception // syntax for this in C++ ?? */) {
Bar* foo = new Bar;
} finally {
for (int i = 0; i < 2; ++i);
do { nothing; } while (false);
if (!true || !!'' && " " | 3 & 7);
while (false | true & false) nothing;
int a[5];
a[3] = 0;
A qq;
qq.re = RegExp("2");
}
return NULL;
}
void not_reserved_words() {
tryThis();
throwThis();
catchThis();
finallyThis();
returnThis();
varThis();
constThis();
newThis();
voidThis();
ifThis();
elseThis();
elsif;
instanceofThis();
}

Просмотреть файл

@ -0,0 +1,92 @@
var number = 1;
var regexp = /this/;
var regexpi = /InSensitive/i;
/* simple C style comment */
(void) 1;
// simple C++ style comment
(void) 2;
(void)3;
const constant = 3;
var single_quoted_string = 'singly quoted string';
var double_quoted_string = "doubly quoted string";
var array = [];
var array2 = [1, , ];
function foo(argument, argument2, argument3,
argument4) {
if (condition) {
expression;
} else if (!condition2) {
expression2;
expression3;
} else {
if (other && conditions) {
!expression;
}
}
}
function exception() {
try {
throw 1;
} catch (e) {
do_something;
} finally {
return something_else;
}
return not_reached;
}
function MyClass() {
this._foo = 0;
}
MyClass.prototype = {
constructor: MyClass,
foo: function () {
return this._foo++;
}
};
var array3 = new Array("a", "big", "bird", "can't" + " fly");
function reserved_words() {
try {} catch (e instanceof Exception) {
var foo = new Bar;
} finally {
for each (var i in {});
do { nothing; } while (false);
if (!true || !!'' && " " | 3 & 7);
while (false | true & false) nothing;
a = [];
a[3] = 0;
a.q = RegExp("2");
}
null == undefined;
null !== undefined;
var z |= 15 ^ 29;
return null;
}
function not_reserved_words() {
tryThis();
throwThis();
catchThis();
finallyThis();
returnThis();
varThis();
constThis();
newThis();
voidThis();
ifThis();
elseThis();
elsif;
instanceofThis();
}
first_decl =
second_decl =
function
named_decl(
)
{}

Просмотреть файл

@ -0,0 +1,81 @@
use TestCase;
require 'testInclude.pl';
my $number = 1;
my $regexp = /this/;
my $regexpi = /InSensitive/i;
# simple perl sytle comment
1;
const constant = 3;
my $single_quoted_string = 'singly quoted string';
my $double_quoted_string = "doubly quoted string";
my @array = ();
my @array2 = (1, , );
sub foo {
my ($argument, $argument2, $argument3,
$argument4) = @_;
if ($condition) {
expression;
} elsif (!$condition2) {
expression2;
expression3;
} else {
if ($other && $conditions) {
!expression;
}
}
}
sub exception {
try {
throw 1;
} catch (e) {
do_something;
} finally {
return something_else;
}
return not_reached;
}
sub MyClass() {
this._foo = 0;
}
my $array3 = ("a", "big", "bird", "can't" . " fly");
sub reserved_words() {
try {} catch (e instanceof Exception) {
var foo = new Bar;
} finally {
for each (var i in {});
do { nothing; } while (false);
if (!true || !!'' && " " | 3 & 7);
while (false | true & false) nothing;
a = [];
a[3] = 0;
a.q = RegExp("2");
}
null == undefined;
null !== undefined;
var z |= 15 ^ 29;
return null;
}
sub not_reserved_words() {
tryThis();
throwThis();
catchThis();
finallyThis();
returnThis();
varThis();
constThis();
newThis();
voidThis();
ifThis();
elseThis();
elsifThis;
instanceofThis();
}