This commit is contained in:
Edgar 2024-02-18 10:40:19 +01:00
parent ccc70b9122
commit 314750a3b5
No known key found for this signature in database
GPG key ID: 70ADAE8F35904387
4 changed files with 41 additions and 1 deletions

View file

@ -9,6 +9,7 @@ mod common;
#[test_case(include_str!("programs/while.ed"), "while", false, 10, &[] ; "r#while")] #[test_case(include_str!("programs/while.ed"), "while", false, 10, &[] ; "r#while")]
#[test_case(include_str!("programs/factorial.ed"), "factorial", false, 24, &[] ; "factorial")] #[test_case(include_str!("programs/factorial.ed"), "factorial", false, 24, &[] ; "factorial")]
#[test_case(include_str!("programs/refs.ed"), "refs", false, 2, &[] ; "refs")] #[test_case(include_str!("programs/refs.ed"), "refs", false, 2, &[] ; "refs")]
#[test_case(include_str!("programs/struct.ed"), "struct", false, 5, &[] ; "r#struct")]
#[test_case(TEST_ADD, "TEST_ADD", false, 2, &[] ; "TEST_ADD")] #[test_case(TEST_ADD, "TEST_ADD", false, 2, &[] ; "TEST_ADD")]
#[test_case(TEST_SUB, "TEST_SUB", false, 1, &[] ; "TEST_SUB")] #[test_case(TEST_SUB, "TEST_SUB", false, 1, &[] ; "TEST_SUB")]
#[test_case(TEST_MUL, "TEST_MUL", false, 4, &[] ; "TEST_MUL")] #[test_case(TEST_MUL, "TEST_MUL", false, 4, &[] ; "TEST_MUL")]

View file

@ -0,0 +1,20 @@
mod Main {
struct Hello {
a: i32,
b: i64,
}
pub fn main() -> i64 {
let x: Hello = Hello {
a: 2,
b: 3,
};
hello(&mut x);
return x.b;
}
pub fn hello(a: &mut Hello) {
a.b = 5;
}
}

20
programs/struct.ed Normal file
View file

@ -0,0 +1,20 @@
mod Main {
struct Hello {
a: i32,
b: i64,
}
pub fn main() -> i64 {
let x: Hello = Hello {
a: 2,
b: 3,
};
hello(&mut x);
return x.b;
}
pub fn hello(a: &mut Hello) {
a.b = 5;
}
}

1
what
View file

@ -1 +0,0 @@
Compiling edlang_parser v0.0.1-alpha.7 (/data2/edgar/edlang/lib/edlang_parser)