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
05519035
Commit
05519035
authored
Apr 24, 2020
by
Eric Myhre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test for nested structs with stringjoin repr.
Works.
parent
2c41e282
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
37 additions
and
0 deletions
+37
-0
schema/gen/go/testStructReprStringjoin_test.go
schema/gen/go/testStructReprStringjoin_test.go
+37
-0
No files found.
schema/gen/go/testStructReprStringjoin_test.go
View file @
05519035
...
@@ -103,5 +103,42 @@ func TestStructReprStringjoin(t *testing.T) {
...
@@ -103,5 +103,42 @@ func TestStructReprStringjoin(t *testing.T) {
Wish
(
t
,
n
,
ShouldEqual
,
nr
)
Wish
(
t
,
n
,
ShouldEqual
,
nr
)
})
})
})
})
t
.
Run
(
"nested stringjoin structs work"
,
func
(
t
*
testing
.
T
)
{
ns
:=
getStyleByName
(
"Recurzorator"
)
nsr
:=
getStyleByName
(
"Recurzorator.Repr"
)
var
n
schema
.
TypedNode
t
.
Run
(
"typed-create"
,
func
(
t
*
testing
.
T
)
{
n
=
fluent
.
MustBuildMap
(
ns
,
3
,
func
(
ma
fluent
.
MapAssembler
)
{
ma
.
AssembleEntry
(
"foo"
)
.
AssignString
(
"v1"
)
ma
.
AssembleEntry
(
"zap"
)
.
CreateMap
(
2
,
func
(
ma
fluent
.
MapAssembler
)
{
ma
.
AssembleEntry
(
"foo"
)
.
AssignString
(
"v2"
)
ma
.
AssembleEntry
(
"bar"
)
.
AssignString
(
"v3"
)
})
ma
.
AssembleEntry
(
"bar"
)
.
AssignString
(
"v4"
)
})
.
(
schema
.
TypedNode
)
t
.
Run
(
"typed-read"
,
func
(
t
*
testing
.
T
)
{
Require
(
t
,
n
.
ReprKind
(),
ShouldEqual
,
ipld
.
ReprKind_Map
)
Wish
(
t
,
n
.
Length
(),
ShouldEqual
,
3
)
Wish
(
t
,
must
.
String
(
must
.
Node
(
n
.
LookupString
(
"foo"
))),
ShouldEqual
,
"v1"
)
Wish
(
t
,
must
.
String
(
must
.
Node
(
n
.
LookupString
(
"bar"
))),
ShouldEqual
,
"v4"
)
n2
:=
must
.
Node
(
n
.
LookupString
(
"zap"
))
Wish
(
t
,
n2
.
Length
(),
ShouldEqual
,
2
)
Wish
(
t
,
must
.
String
(
must
.
Node
(
n2
.
LookupString
(
"foo"
))),
ShouldEqual
,
"v2"
)
Wish
(
t
,
must
.
String
(
must
.
Node
(
n2
.
LookupString
(
"bar"
))),
ShouldEqual
,
"v3"
)
})
t
.
Run
(
"repr-read"
,
func
(
t
*
testing
.
T
)
{
nr
:=
n
.
Representation
()
Require
(
t
,
nr
.
ReprKind
(),
ShouldEqual
,
ipld
.
ReprKind_String
)
Wish
(
t
,
must
.
String
(
nr
),
ShouldEqual
,
"v1-v2:v3-v4"
)
})
})
t
.
Run
(
"repr-create"
,
func
(
t
*
testing
.
T
)
{
nr
:=
fluent
.
MustBuild
(
nsr
,
func
(
na
fluent
.
NodeAssembler
)
{
na
.
AssignString
(
"v1-v2:v3-v4"
)
})
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