Commit Graph

99 Commits

Author SHA1 Message Date
Dave MacLachlan
9b3aaf4bc5 Block deprecated warnings when testing on newer OS
Some of the test methods we use are deprecated on newer OS. This just gets prevents the
warning that we don't actually care about.
2021-06-18 09:58:18 -04:00
Dave MacLachlan
36e9bfc963 Add basic KVO test.
Add a simple KVO test just to verify that KVO continues to function for protobufs.
2021-06-12 14:16:20 -04:00
Thomas Van Lenten
3069f82bbc Tweak tests to allow common protos to evolve more.
Don't check field counts, instead only test based on the fields that exists (and
likely will never exist). This allows the protos to evolve with almost zero
chance of the tests breaking for those other changes.
2021-06-01 15:10:06 -04:00
Deanna Garcia
4c3d50b946 Fixing objc tests 2021-05-24 19:28:04 +00:00
Thomas Van Lenten
23fd8e0791 Use correct enum values.
The clang Xcode 12.5 seems to actually detect this long standing mistake.
2021-05-14 11:48:54 -04:00
Thomas Van Lenten
2f6a7546e4 Update the pod tests to match the new min iOS version. 2020-11-10 11:10:51 -05:00
Thomas Van Lenten
9c27f6a479 Add cast to avoid warning on Xcode 12. 2020-10-21 15:42:09 -04:00
Peter Newman
e2cc2de304
Fix lots of spelling errors (#7751)
* Fix a typo

* Fix lots of spelling errors

* Fix a few more spelling mistakes

* s/parsable/parseable/

* Don't touch the third party files

* Cloneable is the preferred C# term

* Copyable is the preferred C++ term

* Revert "s/parsable/parseable/"

This reverts commit 534ecf7675.

* Revert unparseable->unparsable corrections
2020-08-10 11:08:25 -07:00
Joshua Haberman
1e8d04061c Remove includes of deleted "no_arena" protos from ObjC. 2020-05-13 16:31:53 -07:00
Thomas Van Lenten
7b6016e343 [ObjC] Add tests for proto3 optional behaviors. 2020-04-24 16:36:15 -04:00
Thomas Van Lenten
6f3bda22f4 [ObjC] Fix some tests checking the wrong Message class. 2020-04-14 12:15:23 -04:00
Thomas Van Lenten
56c48ae592 Revisit how the WKTs are bundled with ObjC.
There are have been a few issues around people using case sensitive file systems
what Xcode/clang does when looking at the paths. In attempts to solve one set of
warnings, new warnings/errors happened in different setup. So, to hopefully put
these problem away for got, move the WKTs to be at the same level as the other
headers.

- Revert "Override CocoaPods module to lowercase (#6464)"
  This reverts commit 479ba8226b.
- Move WKTs to the objectivec directory and make the old headers shim back to
  the new locations.
- Update objectivec/generate_well_known_types.sh to check them one at a time
  and to deal with the new locations for them.

Fixes #6803
2020-02-10 12:20:05 -05:00
Dave MacLachlan
f4a6b99339 Block subclassing
Add GPB_FINAL macro to block subclassing of generated ObjC classes.
2020-01-24 11:51:37 -05:00
Dave MacLachlan
ab48ecf140 Update pddm to work with clang-format
Add clang-format off/on directives around pddm expansions to simplify formatting other code.
2020-01-21 13:14:01 -05:00
Dave MacLachlan
74956e1c15 Use references to Objective C classes instead of looking classes up by name.
This should reduce binary size slightly, small performance improvement, and improve linkage by forcing references to all used classes.

Note that this maintains backwards compatibility for sources generated by older protoc for the time being. If you want the benefits
you will need to recompile your protos with the newer protoc.
2020-01-15 15:01:53 -05:00
Brian Wignall
a104dffcb6 Fix typos (#7050)
Uses https://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines to find likely typos, with https://github.com/bwignall/typochecker to help automate the checking.
2020-01-08 10:18:20 -08:00
Thomas Van Lenten
065fa2f395 Remove use of VLA.
VLAs complicate static analysis and bloat stack size. Replace VLA allocation
with calls to malloc and free.  This will alos the code to build with -Wvla.
2019-12-10 17:31:25 -05:00
Thomas Van Lenten
030a38b954 Fix typo that snuck in with last commit. 2019-08-30 11:43:08 -04:00
Thomas Van Lenten
6ec27f0d08 Add an explicit test using secure coding for added safety. 2019-08-30 09:46:30 -04:00
Thomas Van Lenten
b273cba192 Fix enum writing.
Enums use varint, so if the value is negative it should end up being longer.

This was caught my new conformance test cases.
2019-08-26 17:17:32 -04:00
Thomas Van Lenten
1c8a7a10f8 Update some tests for newer clang error messages. 2019-06-06 15:29:59 -04:00
Thomas Van Lenten
d529720e2f If enum aliases overlap in ObjC names skip generating the extras.
Some protos have enum values of "FOO" and "Foo", which the ObjC generation
then makes into the same thing. Just skip generating the enum element for
the duplicate as it would be a compile error because of the name collision.

The descriptors are still generated to support reflection and TextFormat
more completely.
2018-12-18 08:11:58 -05:00
Thomas Van Lenten
1484b58056 [ObjC] Properly annotate extensions for ARC.
Just like fields, some extension fieldnames can be named such that they appear
to have meaning to ARC. Add the annotation to the compiler will get things
correct.

Add a bunch of extensions to allow inspection on generation to ensure things
are correct.
2018-12-05 13:15:30 -05:00
Dave MacLachlan
ef3a725002 Make sure Objective C Proto compiler doesn't "duplicate" prefixes unnecessarily.
In some cases proto files that want/need to use the objc_class_prefix option have
types that already have the prefix on a subset of their names. In this case we don't
want to duplicate the prefix.

Added tests for this (and prefixes in general).
2018-11-27 08:06:36 -05:00
Thomas Van Lenten
92a879b2eb Add a unittest for ObjC TextFormat extension support. 2018-11-14 17:06:51 -05:00
Dave MacLachlan
be83b29bdd Fix bugs in our keyword conversion support for objectivec
We have code for converting C/C++/Objc keywords that appear in protos
to convert them so that they can be compiled.
One of the things we need to be careful of is accidentally overriding methods
that Apple declares in NSObject. It turns out that we have run into issues
where we conflict with "hidden" methods in NSObject or methods added by
categories. method_dump.sh collects all of the methods we care about for
macOS and iOS and dumps them into objectivec_nsobject_methods.h which
is then included in objectivec_helpers.cc as part of the build.

Added a pile of tests to verify that conversions are happening as expected.
2018-11-08 10:29:03 -05:00
Thomas Van Lenten
8c1748f1cd Add tests to confirm strings/bytes are copied. 2018-10-02 13:45:18 -04:00
Feng Xiao
afe98de32a Replace repo links. 2018-08-22 11:55:30 -07:00
Benjamin Barenblat
048f5c26a7 objectivec: Quash -Wself-assign and -Wvla (#4897)
* objectivec: Quash -Wself-assign

* objectivec: Set -Wno-vla when building

Objective-C protobuf uses VLAs for performance reasons. Ensure Clang
doesn’t complain about them.
2018-07-11 13:20:01 -04:00
leovitch
2804902446 [ObjC] Add ability to introspect list of enum values (#4678)
Added new API to GPBEnumDescriptor to enable introspection of enum values.

Refactored implementation so that this contains a minimum of added code.

Clarified comments regarding behavior in the presence of the alias_allowed option.

Added unit tests for new functionality and for the alias case.
2018-05-29 08:08:00 -04:00
Thomas Van Lenten
b59da6d099 Remove the iOS Test App.
The tests can run as what Apple calls a Logic Test (under xctest), which means
it doesn't have to load an full UI App under the simulator, which speeds things
up a fair amount.
2018-04-20 17:26:38 -04:00
Thomas Van Lenten
e998b8ff66 Add compile test sources for to test include order.
To ensure all headers aren't dependent on other things being imported
before/after them, make a source that just imports each header and add
it to the unittesting target, that way we ensure it can be included on
its own with ordering issues.

Also do this testing with a few generated headers that aren't part of
the library to help ensure the different generated imports needed are
complete.
2018-04-02 09:54:29 -04:00
Felix Jendrusch
38508e9bbb Add test for failing write of raw pointer to output stream 2018-03-08 16:20:05 +01:00
Thomas Van Lenten
953adb16ff Add casts to removed undefined behaviors around shifts.
Fixes #4246
Fixes #4247
2018-01-31 12:36:54 -05:00
Thomas Van Lenten
156161dfcd Properly copy maps with string keys but pod values.
Add tests to cover all the common special casing in the runtime code to
ensure things come out correctly.
2018-01-03 11:46:03 -05:00
dmaclach
8537f1e6d5 Fix up warnings from Xcode 9.1 (#3887)
Fix up warnings from Xcode 9.1
2017-11-16 08:24:17 -05:00
Sergio Campama
02129f0a87 Fixes 32bit tests. 2017-11-15 13:14:41 -05:00
Dave MacLachlan
8ae6844cf4 codereview cleanup 2017-11-15 08:49:59 -08:00
Dave MacLachlan
9d7f313372 Reduce size of GPBDictionary by getting rid of class creation methods 2017-11-14 15:37:28 -08:00
Sergio Campama
b1f954e639 Improves coverage of GPBCodedInputStream 2017-10-24 10:44:41 -04:00
Thomas Van Lenten
a274c67caf Build out more complete code coverage in the tests. 2017-10-03 11:54:44 -04:00
Thomas Van Lenten
3f2dcaebe3 ObjC: Fix merging of length delimited unknown fields.
- Add a test to cover this and tweak the test to not use two merge
  paths to be sure things are as expected.
2017-10-02 19:56:25 -04:00
Thomas Van Lenten
1d0988b8ef ObjC: Preserve unknown fields in proto3 syntax files.
As announced: https://groups.google.com/forum/#!topic/protobuf/VX5qEmTW3y0

The ObjC side of https://github.com/google/protobuf/issues/272
2017-06-06 10:44:14 -04:00
Thomas Van Lenten
ecc0f54127 Properly error on a tag with field number zero. 2017-06-06 10:14:41 -04:00
Thomas Van Lenten
46f36d79a2 Fix some cases of reading of 64bit map values.
Fixes https://github.com/google/protobuf/issues/3164.
2017-06-01 14:25:45 -04:00
Sergio Campama
2465ae7e23 Adds serial and parallel parsing tests to check if parallel parsing is faster than serial parsing, which it should 2017-05-23 11:04:35 -04:00
Thomas Van Lenten
49e4ba6098 Fix ExtensionRegistry copying and add tests.
- Fix up -copyWithZone: to not leave the two registries sharing
  some of the storage by using -addExtensions:.
- Improve -addExtensions: to clone the sub dict when there is
  nothing to merge into.
- A ExtensionRegistry unittests.
- Update project schemes to not have extra things in perf scheme.
2017-05-17 14:51:02 -04:00
Thomas Van Lenten
ddb438855a Raise the recursion limit to 100 to match other languages. 2017-03-28 09:10:20 -04:00
Thomas Van Lenten
d07176654b Add GPBMessageDropUnknownFieldsRecursively() and tests.
GPBMessageDropUnknownFieldsRecursively() is a new helper to drop the
unknownFields from a message and all sub messages (in fields or extensions).
2017-02-23 15:04:06 -05:00
Thomas Van Lenten
d0bc096b4a Timestamp helper fix, Duration helper cleanup.
- The Timestamp proto does not allow for negative nanos fields, so the seconds
  must be shifted and a positive nanos then applied.
- Tweak the helpers on Duration to make it clear there is no "base" time
  involved.
- Update the unittests for duration and timestamp to cover positive and
  negative NSTimeIntervals and what their impact is on the protos.
2017-01-12 19:33:25 -05:00