Test that Set() with std::string key and value accepts temporaries (rvalues). This verifies that the parameter is `const std::string&` rather than `std::string&`.
| 32 | // This verifies that the parameter is `const std::string&` rather than |
| 33 | // `std::string&`. |
| 34 | void SetWithTempString(const Napi::CallbackInfo& info) { |
| 35 | Env env = info.Env(); |
| 36 | HandleScope scope(env); |
| 37 | |
| 38 | Napi::ObjectReference ref = Persistent(Object::New(env)); |
| 39 | ref.SuppressDestruct(); |
| 40 | |
| 41 | ref.Set(std::string("tempKey"), std::string("tempValue")); |
| 42 | ref.Set(std::string("anotherKey"), info[0].As<Napi::String>().Utf8Value()); |
| 43 | |
| 44 | assert(MaybeUnwrap(ref.Get("tempKey")).As<Napi::String>().Utf8Value() == |
| 45 | "tempValue"); |
| 46 | assert(MaybeUnwrap(ref.Get("anotherKey")).As<Napi::String>().Utf8Value() == |
| 47 | info[0].As<Napi::String>().Utf8Value()); |
| 48 | } |
| 49 | |
| 50 | void MoveOperatorsTest(const Napi::CallbackInfo& info) { |
| 51 | Napi::ObjectReference existingRef; |
nothing calls this directly
no test coverage detected