Skip to content

Commit

Permalink
test: add a unit test for index API
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <[email protected]>
  • Loading branch information
Rustin170506 committed Mar 28, 2024
1 parent 2bcfd20 commit 1db2c84
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions tracing-core/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,6 +1025,17 @@ mod test {
assert!(valueset.is_empty());
}

#[test]
fn index_of_field_in_fieldset_is_correct() {
let fields = TEST_META_1.fields();
let foo = fields.field("foo").unwrap();
assert_eq!(foo.index(), 0);
let bar = fields.field("bar").unwrap();
assert_eq!(bar.index(), 1);
let baz = fields.field("baz").unwrap();
assert_eq!(baz.index(), 2);
}

#[test]
fn empty_value_set_is_empty() {
let fields = TEST_META_1.fields();
Expand Down

0 comments on commit 1db2c84

Please sign in to comment.