Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
ff85a173
Commit
ff85a173
authored
Aug 12, 2016
by
Thomas Van Lenten
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More complete nil/reset tests within a oneof
parent
a0df678d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
6 deletions
+12
-6
GPBMessageTests+Runtime.m
objectivec/Tests/GPBMessageTests+Runtime.m
+12
-6
No files found.
objectivec/Tests/GPBMessageTests+Runtime.m
View file @
ff85a173
...
...
@@ -2178,7 +2178,7 @@
// Should be set to the correct case.
XCTAssertEqual
(
msg
.
oOneOfCase
,
values
[
i
],
"Loop: %zd"
,
i
);
// Confirm everything is
back as
the defaults.
// Confirm everything is the defaults.
XCTAssertEqual
(
msg
.
oneofInt32
,
100
,
"Loop: %zd"
,
i
);
XCTAssertEqual
(
msg
.
oneofInt64
,
101
,
"Loop: %zd"
,
i
);
XCTAssertEqual
(
msg
.
oneofUint32
,
102U
,
"Loop: %zd"
,
i
);
...
...
@@ -2194,22 +2194,25 @@
XCTAssertEqual
(
msg
.
oneofBool
,
YES
,
"Loop: %zd"
,
i
);
XCTAssertEqualObjects
(
msg
.
oneofString
,
oneofStringDefault
,
"Loop: %zd"
,
i
);
XCTAssertEqualObjects
(
msg
.
oneofBytes
,
oneofBytesDefault
,
"Loop: %zd"
,
i
);
XCTAssertNotNil
(
msg
.
oneofGroup
,
"Loop: %zd"
,
i
);
// Skip group
// Skip message
// Skip group, no default to consider.
// Skip message, no default to consider.
XCTAssertEqual
(
msg
.
oneofEnum
,
Message2_Enum_Baz
,
"Loop: %zd"
,
i
);
}
// We special case nil on string, data, group,
message, ensure they work as
// expected. i.e. - it clears the case.
// We special case nil on string, data, group,
and message, ensure they work
//
as
expected. i.e. - it clears the case.
msg
.
oneofString
=
nil
;
XCTAssertEqualObjects
(
msg
.
oneofString
,
oneofStringDefault
);
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message2_O_OneOfCase_GPBUnsetOneOfCase
);
msg
.
oneofBytes
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message2_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqualObjects
(
msg
.
oneofBytes
,
oneofBytesDefault
);
msg
.
oneofGroup
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message2_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertNotNil
(
msg
.
oneofGroup
);
msg
.
oneofMessage
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message2_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertNotNil
(
msg
.
oneofMessage
);
[
msg
release
];
}
...
...
@@ -2329,10 +2332,13 @@
// We special case nil on string, data, message, ensure they work as expected.
msg
.
oneofString
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqualObjects
(
msg
.
oneofString
,
oneofStringDefault
);
msg
.
oneofBytes
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertEqualObjects
(
msg
.
oneofBytes
,
oneofBytesDefault
);
msg
.
oneofMessage
=
nil
;
XCTAssertEqual
(
msg
.
oOneOfCase
,
Message3_O_OneOfCase_GPBUnsetOneOfCase
);
XCTAssertNotNil
(
msg
.
oneofMessage
);
[
msg
release
];
}
...
...
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