mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
Update tests to (Foo) { ... } syntax.
This commit is contained in:
@@ -20,7 +20,7 @@ fn int test()
|
||||
int foo2 = $foo[2];
|
||||
var $foos = { "Hello!" };
|
||||
char* str = $foos[0];
|
||||
bool x = ! int[] { 1, 2, 3 };
|
||||
bool x = ! (int[]) { 1, 2, 3 };
|
||||
Bar b = {};
|
||||
Baz z = {};
|
||||
int[] sub = {};
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
// #target: windows-x64
|
||||
module test;
|
||||
const int[?] X = int[?] { 1, 2, 3 };
|
||||
int[?] y = int[?] { 1, 2, 3 };
|
||||
const int[?] X = (int[?]) { 1, 2, 3 };
|
||||
int[?] y = (int[?]) { 1, 2, 3 };
|
||||
|
||||
fn void main()
|
||||
{
|
||||
int x = $typeof(int[?] { 1, 2, 3}).len;
|
||||
int x = $typeof((int[?]) { 1, 2, 3}).len;
|
||||
int z = X.len;
|
||||
int w = y.len;
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ struct Bar (Foo)
|
||||
fn int main() {
|
||||
Test(<Foo>) a = {{}};
|
||||
Test(<any>) b = {{}};
|
||||
Test(<Foo>) a2 = {Bar{}}; // #error: It is not possible to cast
|
||||
Test(<Foo>) a2 = {(Bar){}}; // #error: It is not possible to cast
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -6,6 +6,6 @@ macro test(foo)
|
||||
|
||||
fn void main()
|
||||
{
|
||||
test(int[] { 1, 2 });
|
||||
test((int[]) { 1, 2 });
|
||||
test({ 1, 2 }); // #error: It is only possible to use an untyped list as a
|
||||
}
|
||||
@@ -17,14 +17,14 @@ struct Bar
|
||||
|
||||
Bar[] arrbar = { { 3, 4 }, { 8, 9 }};
|
||||
int[] xd = { 1, 2 };
|
||||
int* fofeo = &&(int[2]{ 3, 4 });
|
||||
int* fofeo = &&((int[2]){ 3, 4 });
|
||||
|
||||
fn int main()
|
||||
{
|
||||
Bar w = arrbar[1];
|
||||
libc::printf("%d\n", arrbar[1].x);
|
||||
int[] x = { 1, 2, 3 };
|
||||
int* y = &&(int[3]{ 123, 234, 567 });
|
||||
int* y = &&((int[3]){ 123, 234, 567 });
|
||||
io::printn("Start:");
|
||||
libc::printf("X len: %d mid element %d\n", (int)(x.len), x[1]);
|
||||
libc::printf("Y mid element %d\n", y[1]);
|
||||
@@ -33,7 +33,7 @@ fn int main()
|
||||
int[1] azz = {};
|
||||
|
||||
//var $foo = { 1, 2, 3 };
|
||||
bool xy = ! int[] { 1, 2, 3 };
|
||||
bool xy = !(int[]){ 1, 2, 3 };
|
||||
if (!xy) io::printn("Ok");
|
||||
Bar b = {};
|
||||
Baz z = {};
|
||||
|
||||
Reference in New Issue
Block a user