Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ld
go-ld-prime
Commits
310914cd
Commit
310914cd
authored
Jul 30, 2020
by
Eric Myhre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add tests for struct with tuple repr with absent optionals. Works.
parent
f9a9f45b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
1 deletion
+33
-1
schema/gen/go/testStructReprTuple_test.go
schema/gen/go/testStructReprTuple_test.go
+33
-1
No files found.
schema/gen/go/testStructReprTuple_test.go
View file @
310914cd
...
...
@@ -106,6 +106,38 @@ func TestStructReprTuple(t *testing.T) {
})
})
// todo: fourtuple with absents
t
.
Run
(
"fourtuple with absents"
,
func
(
t
*
testing
.
T
)
{
np
:=
getPrototypeByName
(
"FourTuple"
)
nrp
:=
getPrototypeByName
(
"FourTuple.Repr"
)
var
n
schema
.
TypedNode
t
.
Run
(
"typed-create"
,
func
(
t
*
testing
.
T
)
{
n
=
fluent
.
MustBuildMap
(
np
,
2
,
func
(
ma
fluent
.
MapAssembler
)
{
ma
.
AssembleEntry
(
"foo"
)
.
AssignString
(
"0"
)
ma
.
AssembleEntry
(
"bar"
)
.
AssignNull
()
})
.
(
schema
.
TypedNode
)
t
.
Run
(
"typed-read"
,
func
(
t
*
testing
.
T
)
{
Require
(
t
,
n
.
ReprKind
(),
ShouldEqual
,
ipld
.
ReprKind_Map
)
Wish
(
t
,
n
.
Length
(),
ShouldEqual
,
4
)
Wish
(
t
,
must
.
String
(
must
.
Node
(
n
.
LookupByString
(
"foo"
))),
ShouldEqual
,
"0"
)
Wish
(
t
,
must
.
Node
(
n
.
LookupByString
(
"bar"
)),
ShouldEqual
,
ipld
.
Null
)
Wish
(
t
,
must
.
Node
(
n
.
LookupByString
(
"baz"
)),
ShouldEqual
,
ipld
.
Absent
)
Wish
(
t
,
must
.
Node
(
n
.
LookupByString
(
"qux"
)),
ShouldEqual
,
ipld
.
Absent
)
})
t
.
Run
(
"repr-read"
,
func
(
t
*
testing
.
T
)
{
nr
:=
n
.
Representation
()
Require
(
t
,
nr
.
ReprKind
(),
ShouldEqual
,
ipld
.
ReprKind_List
)
Wish
(
t
,
nr
.
Length
(),
ShouldEqual
,
2
)
Wish
(
t
,
must
.
String
(
must
.
Node
(
nr
.
LookupByIndex
(
0
))),
ShouldEqual
,
"0"
)
Wish
(
t
,
must
.
Node
(
nr
.
LookupByIndex
(
1
)),
ShouldEqual
,
ipld
.
Null
)
})
})
t
.
Run
(
"repr-create"
,
func
(
t
*
testing
.
T
)
{
nr
:=
fluent
.
MustBuildList
(
nrp
,
4
,
func
(
la
fluent
.
ListAssembler
)
{
la
.
AssembleValue
()
.
AssignString
(
"0"
)
la
.
AssembleValue
()
.
AssignNull
()
})
Wish
(
t
,
n
,
ShouldEqual
,
nr
)
})
})
})
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment