-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtests.rs
55 lines (49 loc) · 1.34 KB
/
tests.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#[cfg(test)]
mod tests {
use inline_vbs::*;
use variant_rs::call;
#[test]
fn test_statements() {
ruby! {
def strrb
return "Hello from Ruby"
end
def wsh
wsh = WIN32OLE.new("WScript.Shell")
return wsh
end
wsh.Popup(strrb)
}
perl! {
sub strpl {
return "@{[$Ruby->strrb()]} and Perl";
}
$Ruby->wsh->Popup(strpl());
}
let strrs = format!("{} and Rust", perl_! { strpl }.expect_string());
let wsh = js_! { new ActiveXObject("WScript.Shell") }
.expect_dispatch()
.unwrap();
call!(wsh, Popup(strrs)).unwrap();
vbs! {
strvb = 'strrs & " and VBScript"
Ruby.wsh.Popup(strvb)
}
js! {
var strjs = strvb + " and JScript";
Ruby.wsh.Popup(strjs);
}
vbs! {
Function Square(x)
Square = x * x
End Function
}
assert_eq!(vbs_!(Square(2)), Variant::I16(4));
vbs! {
variable = "Sasha"
}
assert_eq!(vbs_!(variable), "Sasha".into());
let name = "inline_vbs";
assert_eq!(vbs_!["Hello" & 123 & 'name], "Hello123inline_vbs".into());
}
}