-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_string_ctor.cpp
More file actions
31 lines (26 loc) · 863 Bytes
/
test_string_ctor.cpp
File metadata and controls
31 lines (26 loc) · 863 Bytes
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
#include <jaiscript/jaiscript.hpp>
#include <iostream>
int main() {
std::cerr << "=== ONLY Test 2: Check text field on converted Label ===" << std::endl;
try {
auto eng2 = jai::engine::make();
eng2->execute(R"(
class Label {
string text = "";
Label(string s) {
this.text = s;
}
}
auto check_text(Label l) -> string {
return l.text;
}
var result = check_text("Hello");
)");
auto result = eng2->execute("result");
std::cerr << "result = '" << result.as<std::string>() << "'" << std::endl;
std::cerr << "Test 2 passed!" << std::endl;
} catch (const std::exception& e) {
std::cerr << "Test 2 failed: " << e.what() << std::endl;
}
return 0;
}