Skip to content

Commit

Permalink
fix last tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lenscas committed Dec 3, 2023
1 parent 1946644 commit 421d7f8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@
"tempfile",
"userdata"
],
"rust-analyzer.cargo.features": ["mlua","mlua_vendored","mlua_lua54","mlua_async"]
"rust-analyzer.cargo.features": ["mlua","mlua_vendored","mlua_lua54","mlua_async","mlua_send"]
}
5 changes: 2 additions & 3 deletions tests/mlua/async.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tealr::{
//derive TealDerive, which does both. However you will still need to import
//UserData and TypeName
//The clone is only needed because one of the example functions has it as a parameter
#[derive(Clone, UserData, TypeName)]
#[derive(Clone, UserData, ToTypename)]
struct Example {}

//now, implement TealData. This tells rlua what methods are available and tealr what the types are
Expand Down Expand Up @@ -46,8 +46,7 @@ fn async_fn() -> Result<()> {
//however, as we turn it back into a string it is technically possible to get an error
//in this case, as &str's where used it can't happen though, so the .expect is fine
.expect("oh no :(");

assert_eq!(file_contents, "global record test\n\trecord Example\n\t\tuserdata\n\n\t\t-- Pure methods\n\t\texample_method: function(Example,integer):(integer)\n\n\t\t-- Pure functions\n\t\texample_method_mut: function((integer),(string)):(string)\n\n\t\texample_function: function({string}):(({string}),(integer))\n\n\t\t-- Mutating functions\n\t\texample_function_mut: function((boolean),(Example)):((boolean),(Example))\n\n\n\tend\nend\nreturn test");
assert_eq!(file_contents, "global record test\n\trecord Example\n\t\tuserdata\n\n\t\t-- Pure methods\n\t\texample_method: function(self:Example , integer):integer\n\n\t\t-- Pure functions\n\t\texample_method_mut: function(integer , string):string\n\n\t\texample_function: function({string}):{string} , integer\n\n\t\t-- Mutating functions\n\t\texample_function_mut: function(boolean , Example):boolean , Example\n\n\n\tend\nend\nreturn test");
//normally you would now save the file somewhere.
println!("{}\n ", file_contents);

Expand Down

0 comments on commit 421d7f8

Please sign in to comment.