Skip to content

Commit 1bc36ea

Browse files
committed
test: add a unit test for index API
Signed-off-by: hi-rustin <[email protected]>
1 parent 395b684 commit 1bc36ea

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

tracing-core/src/field.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,17 @@ mod test {
10251025
assert!(valueset.is_empty());
10261026
}
10271027

1028+
#[test]
1029+
fn index_of_field_in_fieldset_is_correct() {
1030+
let fields = TEST_META_1.fields();
1031+
let foo = fields.field("foo").unwrap();
1032+
assert_eq!(foo.index(), 0);
1033+
let bar = fields.field("bar").unwrap();
1034+
assert_eq!(bar.index(), 1);
1035+
let baz = fields.field("baz").unwrap();
1036+
assert_eq!(baz.index(), 2);
1037+
}
1038+
10281039
#[test]
10291040
fn empty_value_set_is_empty() {
10301041
let fields = TEST_META_1.fields();

0 commit comments

Comments
 (0)