Add more test cases
Signed-off-by: szdytom <szdytom@qq.com>
This commit is contained in:
parent
14bc07ec9c
commit
7857473434
@ -32,7 +32,7 @@ def test_compiler(test_dir, should_fail):
|
|||||||
passed_files += 1
|
passed_files += 1
|
||||||
else:
|
else:
|
||||||
if 'error' in result.stdout:
|
if 'error' in result.stdout:
|
||||||
print(f' {Color.RED}测试失败:{Color.RESET} {file_path} 应该编译通过,但是发现错误: {result.stderr}')
|
print(f' {Color.RED}测试失败:{Color.RESET} {file_path} 应该编译通过,但是发现错误。')
|
||||||
has_failed_tests = True
|
has_failed_tests = True
|
||||||
else:
|
else:
|
||||||
print(f' {Color.GREEN}测试通过:{Color.RESET} {file_path}')
|
print(f' {Color.GREEN}测试通过:{Color.RESET} {file_path}')
|
||||||
|
8
tests/fail/lang-change-local-var.ac
Normal file
8
tests/fail/lang-change-local-var.ac
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
struct {
|
||||||
|
|
||||||
|
T1 = Fn<A, B>(h: A, y: B) -> A {
|
||||||
|
z = y;
|
||||||
|
z = h;
|
||||||
|
return z;
|
||||||
|
};
|
||||||
|
} main;
|
8
tests/fail/logic-use-self.ac
Normal file
8
tests/fail/logic-use-self.ac
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
struct {
|
||||||
|
|
||||||
|
T1 = Fn<A, B>(h: A) -> B {
|
||||||
|
return T1<A, B>(h);
|
||||||
|
};
|
||||||
|
|
||||||
|
} main;
|
||||||
|
|
7
tests/ok/function-types1.ac
Normal file
7
tests/ok/function-types1.ac
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
struct {
|
||||||
|
|
||||||
|
T1 = Fn<A, B>(h1: Fn(<>, <A>, B), h2: A) -> B {
|
||||||
|
return h1(h2);
|
||||||
|
};
|
||||||
|
|
||||||
|
} main;
|
7
tests/ok/function-types2.ac
Normal file
7
tests/ok/function-types2.ac
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
struct {
|
||||||
|
|
||||||
|
T1 = Fn<B>(h1: Fn(<C>, <C>, B)) -> B {
|
||||||
|
return h1<typeof(h1)>(h1);
|
||||||
|
};
|
||||||
|
|
||||||
|
} main;
|
9
tests/ok/lambda-capture.ac
Normal file
9
tests/ok/lambda-capture.ac
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
struct {
|
||||||
|
|
||||||
|
T = Fn<a, b, c>(z: Fn(<>, <a>, b), y: Fn(<>, <b>, c)) -> Fn(<>, <a>, c) {
|
||||||
|
return Fn<>(h: a) -> c {
|
||||||
|
return y(z(h));
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
} main;
|
8
tests/ok/local-vars.ac
Normal file
8
tests/ok/local-vars.ac
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
struct {
|
||||||
|
|
||||||
|
T1 = Fn<A>(h1: A) -> A {
|
||||||
|
h2 = h1;
|
||||||
|
return h2;
|
||||||
|
};
|
||||||
|
|
||||||
|
} main;
|
15
tests/ok/multi-thoerems.ac
Normal file
15
tests/ok/multi-thoerems.ac
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
struct {
|
||||||
|
|
||||||
|
T1 = Fn<A>(a: A) -> A {
|
||||||
|
return a;
|
||||||
|
};
|
||||||
|
|
||||||
|
T2 = Fn<b>(a: b) -> b {
|
||||||
|
return a;
|
||||||
|
};
|
||||||
|
|
||||||
|
T3 = Fn<c>(a: c) -> c {
|
||||||
|
return T2<c>(T2<c>(T1<c>(a)));
|
||||||
|
};
|
||||||
|
|
||||||
|
} main;
|
9
tests/ok/nested-types.ac
Normal file
9
tests/ok/nested-types.ac
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
struct {
|
||||||
|
|
||||||
|
T1 = Fn<B>(h1: Fn(<C>, <Fn(<>, <C>, C)>, B)) -> B {
|
||||||
|
return h1<B>(Fn<>(h: B) -> B{
|
||||||
|
return h;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
} main;
|
7
tests/ok/unicode-letters.ac
Normal file
7
tests/ok/unicode-letters.ac
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
struct {
|
||||||
|
|
||||||
|
中文定理名称 = Fn<来>(啊: 来) -> 来 {
|
||||||
|
return 啊;
|
||||||
|
};
|
||||||
|
|
||||||
|
} main;
|
Loading…
x
Reference in New Issue
Block a user