C++ interpreter: Use std::span instead of the internal Slice in the public API

This commit is contained in:
Olivier Goffart 2022-01-24 12:12:50 +01:00
parent d0b3adeba9
commit 973c5960b7
5 changed files with 37 additions and 32 deletions

View file

@ -366,7 +366,7 @@ SCENARIO("Invoke callback")
return Value(SharedString(res));
}));
Value args[] = { SharedString("Hello"), 42. };
auto res = instance->invoke_callback("some_callback", Slice<Value> { args, 2 });
auto res = instance->invoke_callback("some_callback", args);
REQUIRE(res.has_value());
REQUIRE(*res->to_string() == SharedString("Hello:42"));
}
@ -379,7 +379,7 @@ SCENARIO("Invoke callback")
auto instance = result->create();
REQUIRE(!instance->set_callback("bar", [](auto) { return Value(); }));
Value args[] = { SharedString("Hello"), 42. };
auto res = instance->invoke_callback("bar", Slice<Value> { args, 2 });
auto res = instance->invoke_callback("bar", args);
REQUIRE(!res.has_value());
}
}
@ -573,8 +573,7 @@ SCENARIO("Global properties")
REQUIRE(result->to_string().value() == "ABC");
Value args[] = { SharedString("Hello") };
auto res = instance->invoke_global_callback("The_Global", "to-uppercase",
Slice<Value> { args, 1 });
auto res = instance->invoke_global_callback("The_Global", "to-uppercase", args);
REQUIRE(res.has_value());
REQUIRE(*res->to_string() == SharedString("HELLO"));
}