-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add "fixme" test and update negative test
- Loading branch information
1 parent
b828267
commit 3258692
Showing
2 changed files
with
24 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
// SPDX-License-Identifier: Apache-2.0 OR MIT | ||
|
||
// Check that `variant_count` is supported and returns the expected result. | ||
|
||
#![feature(variant_count)] | ||
use std::mem; | ||
|
||
enum Void {} | ||
enum MyError { | ||
Error1, | ||
Error2, | ||
Error3, | ||
} | ||
|
||
fn main() { | ||
assert!(mem::variant_count::<Void>() == 0); | ||
assert!(mem::variant_count::<MyError>() == 3); | ||
assert!(mem::variant_count::<Option<u32>>() == 2); | ||
assert!(mem::variant_count::<Result<u32, MyError>>() == 2); | ||
} |