Commit Graph

42 Commits

Author SHA1 Message Date
Nikolai Vazquez 6007df8a53 Make assert_impl_one! work with all combinations
Fixes the issue where subsequent traits were only checked against the
first trait and not to one another. This solution was made possible by
@SimonSapin demonstrating to me how to expand the input sequence into
combinations of inputs.

Closes #20.
2019-10-18 13:29:04 -04:00
Nikolai Vazquez b9e803feaf Add assert_impl_any! macro
Closes #19.

Based on the implementation provided by @Lej77.
2019-10-17 15:27:51 -04:00
Nikolai Vazquez 9a6533104d Separate type with colon in assert_fields! 2019-09-27 13:09:58 -04:00
Nikolai Vazquez 3f14f783a1 Fix how assert_fields! works with enums 2019-08-28 20:09:14 -07:00
Nikolai Vazquez eae7d9e0bf Rename assert_{ne,eq}_type! macros
Makes them more similar to the API exposed by `assert_impl` macros.
2019-08-23 11:56:44 -07:00
Nikolai Vazquez b26c920b9d Update tests to reflect new API 2019-08-23 11:12:22 -07:00
Nikolai Vazquez d02f2ca5b7 Add assert_ne_type! macro 2019-05-15 00:47:02 +02:00
Nikolai Vazquez b416d039f6 Make assert_eq_type! work with ?Sized types 2019-05-15 00:29:17 +02:00
Nikolai Vazquez 2c18babf41 Rename 'eq_ty.rs' to 'eq_type.rs' 2019-05-14 23:37:29 +02:00
Nikolai Vazquez 0186c7e63b Allow unused X in 'tests/eq_ty.rs' 2019-05-14 23:36:34 +02:00
Nikolai Vazquez 64961afe43 Add assert_eq_type! macro
Produces a rather nice error message: "expected $ty1, found $ty2".

Fixes #9.
2019-05-14 23:28:47 +02:00
Nikolai Vazquez ecbbd84222 Remove macro labeling when targeting nightly Rust 2018-11-14 01:36:06 -05:00
Nikolai Vazquez f98d53575e Add #[allow(unsafe_code)] in assert_eq_size_ptr
The code never runs, thus it's ok to compile with the lint enabled.
2017-12-12 01:10:56 -05:00
Nikolai Vazquez d6ee8bda0b Use closure for assert_eq_size_ptr implementation
This way it doesn't ever run the code. Thus, letting it work with bogus
pointer values.
2017-12-12 01:08:16 -05:00
Nikolai Vazquez 07df777ea4 Test assert_eq_size_ptr against mutable references 2017-12-12 01:07:18 -05:00
Nikolai Vazquez c44a0313b5 Remove failure tests
Compile failures are checked thoroughly within the crate's doc tests.
2017-12-11 05:48:05 -05:00
Nikolai Vazquez 9343ec3541 Remove label test in eq_size
While the test may pass, it prevents from being alerted on Travis when
the other size tests don't pass.
2017-11-08 15:13:57 -05:00
Nikolai Vazquez bf311bc724 Fix generics issue in assert_impl by using path
This also allows for testing traits that aren't in the current scope.
2017-09-21 03:35:40 -04:00
Nikolai Vazquez 24407680d3 [Tests] Fix type used for fields failure 2017-09-10 14:48:15 -04:00
Nikolai Vazquez ef3471b161 Add assert_fields macro 2017-09-10 14:34:46 -04:00
Nikolai Vazquez 4524154386 [Tests] Make assert_impl test even more obscure 2017-08-13 19:28:04 -04:00
Nikolai Vazquez b54278c5ea [Tests] Ensure assert_impl works for obscure types 2017-08-13 19:18:26 -04:00
Nikolai Vazquez 326feddbcc [Tests] Check assert_impl for slice IntoIterator 2017-08-13 16:18:56 -04:00
Nikolai Vazquez f4f23735b2 [Tests] Check assert_impl against byte slice 2017-08-13 15:53:16 -04:00
Nikolai Vazquez cdcd2f337a [Tests] Add failure case for assert_impl 2017-08-13 15:48:47 -04:00
Nikolai Vazquez 9c2b158d93 Create assert_impl macro 2017-08-13 15:46:34 -04:00
Nikolai Vazquez 047852274d Create assert_obj_safe macro 2017-08-13 11:15:21 -04:00
Nikolai Vazquez a4b1fcddea [Tests] Test assert_eq_size against Self type
The new implementation as of commit e48415c should enable this pattern.
2017-08-13 02:38:17 -04:00
Nikolai Vazquez dd6e42927f [Tests] Fix same label failure macro 2017-08-13 02:24:58 -04:00
Nikolai Vazquez f3da7e474f Enable assert_eq_size anywhere like const_assert
This is a partial solution to issue #1.
2017-08-13 02:19:42 -04:00
Nikolai Vazquez b7ca44ea33 Enable const_assert anywhere with an exception
If used outside of a function, a unique label is required.

This is a partial solution to issue #1.
2017-08-13 01:25:40 -04:00
Nikolai Vazquez a196f72676 [Tests] Add failing tests
Enabled via the 'failure' feature.
2017-08-12 18:44:23 -04:00
Nikolai Vazquez 9c40c746ac [Tests] Add const fn and associated const tests 2017-08-12 18:09:23 -04:00
Nikolai Vazquez 6fc86288b5 [Tests] Make DropCounter count() return non-ref 2017-08-12 17:48:42 -04:00
Nikolai Vazquez 52dd42f3bf [Tests] Add more assert_eq_size_val calls for DC 2017-08-12 17:14:49 -04:00
Nikolai Vazquez d44a78e4eb Create const_assert macro
Could also be named 'static_assert' but that would conflict with the
macro in Rust nightly.
2017-08-12 17:10:33 -04:00
Nikolai Vazquez 88e02d3166 Create assert_eq_size_val macro 2017-08-12 15:54:20 -04:00
Nikolai Vazquez 7454ee5cb2 [Tests] Ensure assert_eq_size doesn't drop its val 2017-08-12 15:26:38 -04:00
Nikolai Vazquez ade97ce600 [Tests] Ensure no 'unused_unsafe' warning is given 2017-08-12 14:52:01 -04:00
Nikolai Vazquez 2735a82e79 Make assert_eq_size accept more than one type 2017-08-12 14:45:59 -04:00
Nikolai Vazquez 44723583e8 Comment out failing macro
Serves as an example, but shouldn't be emitted because tests will fail.
2017-08-12 14:41:17 -04:00
Nikolai Vazquez 9ffba4ad0d Create assert_eq_size macro 2017-08-12 14:38:51 -04:00