diff options
author | bors-servo <lbergstrom+bors@mozilla.com> | 2018-03-05 12:19:25 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-05 12:19:25 -0500 |
commit | f36f4e3e38d5a4f9c712a5bbde68403ce716dab6 (patch) | |
tree | 656a73545312d459bc01ce76433ac0720a0592bb /tests | |
parent | f9fe3d157192ab0738e08f1da69c4be30ed289d4 (diff) | |
parent | 4c6c9977c8ce93a5753d28278a3eb7571aaddef7 (diff) |
Auto merge of #1268 - emilio:enum-replace, r=fitzgen
ir: Allow replacing enums and enum variants.
Fixes #1267.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/expectations/tests/enum-variant-replaces.rs | 14 | ||||
-rw-r--r-- | tests/headers/enum-variant-replaces.h | 34 |
2 files changed, 48 insertions, 0 deletions
diff --git a/tests/expectations/tests/enum-variant-replaces.rs b/tests/expectations/tests/enum-variant-replaces.rs new file mode 100644 index 00000000..aabcad75 --- /dev/null +++ b/tests/expectations/tests/enum-variant-replaces.rs @@ -0,0 +1,14 @@ +/* automatically generated by rust-bindgen */ + +#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] + +/// <div rustbindgen replaces="PASS"></div> +/// +/// Should see PASS below. +pub const OGRErr_PASS: OGRErr = 0; +/// <div rustbindgen replaces="OGRERR_NONE"></div> +/// +/// Should see OGRERR_NONE instead of CUSTOM_OGRERR_NONE below. +pub const OGRErr_OGRERR_NONE: OGRErr = 1; +/// <div rustbindgen replaces="OGRErr"></div> +pub type OGRErr = u32; diff --git a/tests/headers/enum-variant-replaces.h b/tests/headers/enum-variant-replaces.h new file mode 100644 index 00000000..45eb4d7a --- /dev/null +++ b/tests/headers/enum-variant-replaces.h @@ -0,0 +1,34 @@ + +/** Type for a OGR error */ +typedef enum +{ + OGRERR_NONE, /**< Success */ + OGRERR_NOT_ENOUGH_DATA, /**< Not enough data to deserialize */ + OGRERR_NOT_ENOUGH_MEMORY, /**< Not enough memory */ + OGRERR_UNSUPPORTED_GEOMETRY_TYPE, /**< Unsupported geometry type */ + OGRERR_UNSUPPORTED_OPERATION, /**< Unsupported operation */ + OGRERR_CORRUPT_DATA, /**< Corrupt data */ + OGRERR_FAILURE, /**< Failure */ + OGRERR_UNSUPPORTED_SRS, /**< Unsupported SRS */ + OGRERR_INVALID_HANDLE, /**< Invalid handle */ + OGRERR_NON_EXISTING_FEATURE /**< Non existing feature. Added in GDAL 2.0 */ +} OGRErr; + +/** + * <div rustbindgen replaces="OGRErr"></div> + */ +typedef enum +{ + /** + * <div rustbindgen replaces="PASS"></div> + * + * Should see PASS below. + */ + FAIL, + /** + * <div rustbindgen replaces="OGRERR_NONE"></div> + * + * Should see OGRERR_NONE instead of CUSTOM_OGRERR_NONE below. + */ + CUSTOM_OGRERR_NONE +} StrictOGRErr; |