Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion specifications/objects-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
13 changes: 9 additions & 4 deletions uts/objects/unit/path_object.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"
```

---
Expand Down
Loading