-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
29 changed files
with
300 additions
and
242 deletions.
There are no files selected for viewing
16 changes: 7 additions & 9 deletions
16
crates/languages/bevy_mod_scripting_lua_derive/tests/fail/references/non-proxy-reference.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
...guages/bevy_mod_scripting_lua_derive/tests/fail/references/output-with-proxy-reference.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
use bevy::prelude::*; | ||
use bevy_mod_scripting::api::*; | ||
|
||
#[derive(ScriptProxy, Reflect)] | ||
#[proxy(languages("lua"), derive(Clone))] | ||
#[functions[ | ||
#[lua(Function, output(proxy))] | ||
fn fn_returning_some_string(#[proxy] ref_: &Self ) -> &Self { | ||
#[derive(LuaProxy, Reflect, Clone)] | ||
#[proxy(functions = [ | ||
r#" | ||
#[lua(kind="Function", output(proxy))] | ||
fn fn_returning_some_string(ref_: &Self ) -> &Self { | ||
ref_ | ||
} | ||
]] | ||
#[derive(Clone)] | ||
"#, | ||
])] | ||
pub struct MyStruct; | ||
|
||
pub fn main() {} |
17 changes: 9 additions & 8 deletions
17
crates/languages/bevy_mod_scripting_lua_derive/tests/fail/simple/function-with-receiver.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,21 @@ | ||
use bevy::prelude::*; | ||
use bevy_mod_scripting::api::*; | ||
|
||
#[derive(ScriptProxy, Reflect)] | ||
#[proxy(languages("lua"), derive(Clone))] | ||
#[functions[ | ||
#[lua(Function)] | ||
#[derive(LuaProxy, Reflect, Clone)] | ||
#[proxy(functions = [ | ||
r#" | ||
#[lua(kind="Function")] | ||
fn fn_returning_some_string(self) { | ||
} | ||
"#, | ||
#[lua(Function)] | ||
r#" | ||
#[lua(kind="Function")] | ||
fn fn_returning_proxy(&self) { | ||
} | ||
]] | ||
#[derive(Clone)] | ||
"#, | ||
])] | ||
pub struct MyStruct; | ||
|
||
pub fn main() {} |
14 changes: 7 additions & 7 deletions
14
crates/languages/bevy_mod_scripting_lua_derive/tests/fail/simple/invalid-argument-count.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 7 additions & 7 deletions
14
crates/languages/bevy_mod_scripting_lua_derive/tests/fail/simple/invalid-argument-type.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
crates/languages/bevy_mod_scripting_lua_derive/tests/fail/simple/invalid-function-type.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
use bevy::prelude::*; | ||
use bevy_mod_scripting::api::*; | ||
|
||
#[derive(ScriptProxy, Reflect)] | ||
#[proxy(languages("lua"), derive(Clone))] | ||
#[functions[ | ||
#[lua(AMASJDIASDKAW)] | ||
#[derive(LuaProxy, Reflect, Clone)] | ||
#[proxy(functions = [ | ||
r#" | ||
#[lua(kind="AMASJDIASDKAW")] | ||
fn fn_taking_nothing() { | ||
} | ||
]] | ||
#[derive(Clone)] | ||
"#, | ||
])] | ||
pub struct MyStruct; | ||
|
||
pub fn main() {} |
13 changes: 6 additions & 7 deletions
13
...guages/bevy_mod_scripting_lua_derive/tests/fail/simple/invalid-output-type-custom-body.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
use bevy::prelude::*; | ||
use bevy_mod_scripting::api::*; | ||
|
||
#[derive(ScriptProxy, Reflect)] | ||
#[proxy(languages("lua"), derive(Clone))] | ||
#[functions[ | ||
#[lua(Function)] | ||
#[derive(LuaProxy, Reflect, Clone)] | ||
#[proxy(functions = [ | ||
r#" | ||
#[lua(kind="Function", output(proxy))] | ||
fn fn_returning_proxy() -> Self { | ||
2 | ||
} | ||
]] | ||
#[derive(Clone)] | ||
"#, | ||
])] | ||
pub struct MyStruct; | ||
|
||
pub fn main() {} |
15 changes: 7 additions & 8 deletions
15
crates/languages/bevy_mod_scripting_lua_derive/tests/fail/simple/invalid-output-type.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 9 additions & 7 deletions
16
crates/languages/bevy_mod_scripting_lua_derive/tests/fail/simple/method-without-receiver.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,22 @@ | ||
use bevy::prelude::*; | ||
use bevy_mod_scripting::api::*; | ||
|
||
#[derive(ScriptProxy, Reflect)] | ||
#[proxy(languages("lua"), derive(Clone))] | ||
#[functions[ | ||
#[lua(Method)] | ||
#[derive(LuaProxy, Reflect, Clone)] | ||
#[proxy(functions = [ | ||
r#" | ||
#[lua(kind="Method")] | ||
fn fn_taking_nothing() { | ||
} | ||
"#, | ||
#[lua(Method)] | ||
r#" | ||
#[lua(kind="Method")] | ||
fn fn_taking_usize(arg: usize) { | ||
} | ||
]] | ||
#[derive(Clone)] | ||
"#, | ||
])] | ||
pub struct MyStruct; | ||
|
||
pub fn main() {} |
13 changes: 6 additions & 7 deletions
13
...es/languages/bevy_mod_scripting_lua_derive/tests/fail/simple/missing-proxy-output-attr.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,14 @@ | ||
use bevy::prelude::*; | ||
use bevy_mod_scripting::api::*; | ||
|
||
#[derive(ScriptProxy, Reflect)] | ||
#[proxy(languages("lua"), derive(Clone))] | ||
#[functions[ | ||
#[lua(Function)] | ||
#[derive(LuaProxy, Reflect, Clone)] | ||
#[proxy(functions = [ | ||
r#" | ||
#[lua(kind="Function", output(proxy))] | ||
fn fn_returning_proxy() -> Self { | ||
MyStruct | ||
} | ||
]] | ||
#[derive(Clone)] | ||
"#, | ||
])] | ||
pub struct MyStruct; | ||
|
||
pub fn main() {} |
8 changes: 4 additions & 4 deletions
8
crates/languages/bevy_mod_scripting_lua_derive/tests/macro_tests.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
#[test] | ||
fn success() { | ||
// let t = trybuild::TestCases::new(); | ||
// t.pass("tests/success/**/*.rs"); | ||
let t = trybuild::TestCases::new(); | ||
t.pass("tests/success/**/*.rs"); | ||
} | ||
|
||
#[test] | ||
fn fail() { | ||
// let t = trybuild::TestCases::new(); | ||
// t.compile_fail("tests/fail/**/*.rs"); | ||
let t = trybuild::TestCases::new(); | ||
t.compile_fail("tests/fail/**/*.rs"); | ||
} |
30 changes: 18 additions & 12 deletions
30
crates/languages/bevy_mod_scripting_lua_derive/tests/success/containers/option-argument.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,26 @@ | ||
use bevy::prelude::*; | ||
use bevy_mod_scripting::api::*; | ||
|
||
#[derive(ScriptProxy, Reflect, Clone)] | ||
#[proxy(languages("lua"), derive(Clone))] | ||
#[functions[ | ||
#[lua(Function)] | ||
fn fn_returning_string_option(_opt: Option<String>) { | ||
} | ||
#[derive(LuaProxy, Reflect, Clone)] | ||
#[proxy(functions[ | ||
r#" | ||
#[lua(kind="Function")] | ||
fn fn_returning_string_option(_opt: Option<String>) | ||
"#,r#" | ||
#[lua(kind="Function")] | ||
fn fn_returning_some_proxy(#[proxy] _opt: Option<Self>) | ||
"# | ||
])] | ||
pub struct MyStruct; | ||
|
||
pub fn main() {} | ||
|
||
#[lua(kind = "Function")] | ||
fn fn_returning_string_option(_opt: Option<String>) {} | ||
|
||
#[lua(kind = "Function")] | ||
fn fn_returning_some_proxy(#[proxy] _opt: Option<Self>) {} | ||
|
||
#[lua(Function)] | ||
fn fn_returning_some_proxy(#[proxy] _opt: Option<Self>) { | ||
} | ||
]] | ||
pub struct MyStruct; | ||
|
||
pub fn main() {} |
23 changes: 15 additions & 8 deletions
23
crates/languages/bevy_mod_scripting_lua_derive/tests/success/containers/option-output.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,36 @@ | ||
use bevy::prelude::*; | ||
use bevy_mod_scripting::api::*; | ||
|
||
#[derive(ScriptProxy, Reflect, Clone)] | ||
#[proxy(languages("lua"), derive(Clone))] | ||
#[functions[ | ||
#[lua(Function)] | ||
#[derive(LuaProxy, Reflect, Clone)] | ||
#[proxy(functions[ | ||
r#" | ||
#[lua(kind="Function")] | ||
fn fn_returning_string_option() -> Option<String> { | ||
Some("hello".to_owned()) | ||
} | ||
"#, | ||
#[lua(Function)] | ||
r#" | ||
#[lua(kind="Function")] | ||
fn fn_returning_string_option_none() -> Option<String> { | ||
None | ||
} | ||
"#, | ||
#[lua(Function, output(proxy))] | ||
r#" | ||
#[lua(kind="Function", output(proxy="proxy"))] | ||
fn fn_returning_some_proxy() -> Option<Self> { | ||
Some(MyStruct) | ||
} | ||
"#, | ||
#[lua(Function, output(proxy))] | ||
r#" | ||
#[lua(kind="Function", output(proxy="proxy"))] | ||
fn fn_returning_none_proxy() -> Option<Self> { | ||
None | ||
} | ||
]] | ||
"#, | ||
])] | ||
pub struct MyStruct; | ||
|
||
pub fn main() {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.