diff --git a/specifications/objects-features.md b/specifications/objects-features.md index dbd63b5f0..502d7cc8d 100644 --- a/specifications/objects-features.md +++ b/specifications/objects-features.md @@ -912,8 +912,9 @@ A `PathObject` is obtained from `RealtimeObject#get` ([RTO23](#RTO23)), which re - `(RTPO8a)` Checks the access API preconditions per [RTO25](#RTO25) - `(RTPO8b)` Resolves the path using the path resolution procedure ([RTPO3](#RTPO3)) - `(RTPO8c)` If the resolved value is a `LiveObject` (i.e. a `LiveMap` or `LiveCounter`), returns a new `Instance` ([RTINS1](#RTINS1)) wrapping that `LiveObject` - - `(RTPO8d)` If the resolved value is a primitive, returns undefined/null + - `(RTPO8d)` This clause has been replaced by [RTPO8f](#RTPO8f). - `(RTPO8e)` If path resolution fails, returns undefined/null per [RTPO3c1](#RTPO3c1) + - `(RTPO8f)` If the resolved value is a primitive, returns a new `Instance` ([RTINS1](#RTINS1)) wrapping the primitive value - `(RTPO9)` `PathObject#entries` function: - `(RTPO9a)` Checks the access API preconditions per [RTO25](#RTO25) - `(RTPO9b)` Resolves the path using the path resolution procedure ([RTPO3](#RTPO3)) diff --git a/uts/objects/unit/path_object.md b/uts/objects/unit/path_object.md index e86a1e976..8a4000a4e 100644 --- a/uts/objects/unit/path_object.md +++ b/uts/objects/unit/path_object.md @@ -276,14 +276,16 @@ ASSERT map_inst.id() == "map:profile@1000" --- -## RTPO8c - instance() returns null for primitive +## RTPO8f - instance() returns Instance for primitive -**Test ID**: `objects/unit/RTPO8c/instance-primitive-null-0` +**Test ID**: `objects/unit/RTPO8f/instance-primitive-wrapped-0` | Spec | Requirement | |------|-------------| | RTPO8a | Checks access API preconditions per RTO25 | -| RTPO8d | Primitive -> returns null | +| RTPO8f | Primitive -> Instance wrapping the primitive value | +| RTINS3b | Primitive Instance has no object id | +| RTINS4c | Instance#value returns the primitive value directly | ### Setup ```pseudo @@ -292,7 +294,10 @@ ASSERT map_inst.id() == "map:profile@1000" ### Assertions ```pseudo -ASSERT root.get("name").instance() == null +name_inst = root.get("name").instance() +ASSERT name_inst IS Instance +ASSERT name_inst.id() == null +ASSERT name_inst.value() == "Alice" ``` ---