18 #define ALLOW_STRUCT_FIELDS 34 std::string GetExpectedString() {
48 TestType::~TestType() {}
63 return arg == GetExpectedString();
71 return holds_alternative<int>(arg) && get<int>(arg) ==
EXPECTED_INT;
75 return holds_alternative<TestTypeOptions>(arg) &&
80 return opts.string == GetExpectedString() && opts.boolean;
84 return opts.string.empty() && !opts.boolean;
96 const std::vector<std::string>& data)
const {
102 return anything.
TryConvertTo(&str) && str == GetExpectedString();
112 call_copy(GetExpectedString());
116 this->buffer = std::move(buffer);
134 LocalVar<JsValue> rooted(value.
ToJsValue());
142 ret->ResolveWith(value);
148 return GetExpectedString();
154 return GetExpectedString();
160 return GetExpectedString();
165 ret.string = GetExpectedString();
179 return {
"abc",
"123", GetExpectedString()};
183 std::unordered_map<std::string, std::string> ret;
194 LocalVar<JsValue> value = anything.
ToJsValue();
205 AddMemberFunction(
"acceptStringEnumOrAnyNumber",
218 AddMemberFunction(
"isExpectedStructWithOr",
220 AddMemberFunction(
"isExpectedConvertedStruct",
222 AddMemberFunction(
"isConvertedStructEmpty",
226 AddMemberFunction(
"isExpectedArrayOfStrings",
228 AddMemberFunction(
"isExpectedStringWithAny",
232 AddMemberFunction(
"invokeCallbackWithString",
void AcceptIntOrStruct(variant< int, TestTypeOptions >) const
void AcceptStringEnumOrAnyNumber(variant< TestStringEnum, double >) const
static JsError Error(const std::string &message)
void AcceptByteBuffer(ByteBuffer) const
bool IsExpectedNumberEnum(TestNumberEnum e) const
bool IsOptionalPresent(optional< std::string > arg) const
bool IsExpectedStringWithAny(Any anything) const
constexpr const TestNumberEnum EXPECTED_NUMBER_ENUM
ReturnVal< JsValue > JsUndefined()
void Trace(memory::HeapTracer *tracer) const override
ExceptionOr< void > ThrowException(const std::string &message) const
std::vector< std::string > GetArrayOfStrings() const
TestTypeOptions ChangeStringField(TestTypeOptions opts)
const ByteBuffer & GetByteBuffer() const
optional< Any > optional_object
Promise PromiseResolveAfter(uint64_t delay) const
std::string ToPrettyString(Any anything) const
void AcceptOptionalString(optional< std::string >) const
bool TryConvertTo(T *result) const
bool IsExpectedArrayOfStrings(const std::vector< std::string > &data) const
std::string GetString() const
TestTypeOptions GetStruct() const
constexpr const TestStringEnum EXPECTED_STRING_ENUM
Promise PromiseAcceptString(const std::string &value) const
void AcceptOptionalStruct(optional< TestTypeOptions >) const
bool IsExpectedConvertedStruct(TestTypeOptions opts) const
optional< std::string > GetOptionalString(bool has_value) const
void AcceptArrayOfStrings(std::vector< std::string >) const
void AcceptCallback(Callback) const
bool IsExpectedString(const std::string &arg) const
void AcceptAnything(Any) const
void Trace(const Traceable *ptr)
std::unordered_map< std::string, std::string > GetMapOfStrings() const
constexpr const int EXPECTED_INT
int AddTimer(uint64_t delay_ms, Func &&callback)
static JsManagerImpl * Instance()
void StoreByteBuffer(ByteBuffer buffer)
void AcceptStringEnum(TestStringEnum) const
void AcceptString(const std::string &) const
variant< int, std::string > GetIntOrString(bool get_int) const
void Trace(memory::HeapTracer *tracer) const override
DEFINE_STRUCT_SPECIAL_METHODS_COPYABLE(TestTypeOptions)
bool IsConvertedStructEmpty(TestTypeOptions opts) const
void AcceptBoolean(bool) const
bool IsExpectedStringEnum(TestStringEnum e) const
static Promise PendingPromise()
bool IsExpectedStructWithOr(variant< int, TestTypeOptions > arg) const
variant< int, Any > int_or_object
void AcceptStruct(TestTypeOptions) const
ReturnVal< JsValue > ToJsValue() const override
static Promise Resolved()
TestStringEnum GetStringEnum() const
Promise PromiseResolveWith(Any value) const
void AcceptNumber(double) const
static std::string ConvertToPrettyString(Handle< JsValue > value)
constexpr const char EXPECTED_STRING[]
bool IsTruthy(Any anything) const
void AcceptNumberEnum(TestNumberEnum) const
void InvokeCallbackWithString(Callback callback) const
bool IsExpectedIntWithOr(variant< int, Any > arg) const
TestNumberEnum GetNumberEnum() const
TaskRunner * MainThread()