Skip to content

Commit a26438d

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

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
@@ -1060,6 +1060,17 @@ mod test {
10601060
assert!(valueset.is_empty());
10611061
}
10621062

1063+
#[test]
1064+
fn index_of_field_in_fieldset_is_correct() {
1065+
let fields = TEST_META_1.fields();
1066+
let foo = fields.field("foo").unwrap();
1067+
assert_eq!(foo.index(), 0);
1068+
let bar = fields.field("bar").unwrap();
1069+
assert_eq!(bar.index(), 1);
1070+
let baz = fields.field("baz").unwrap();
1071+
assert_eq!(baz.index(), 2);
1072+
}
1073+
10631074
#[test]
10641075
fn empty_value_set_is_empty() {
10651076
let fields = TEST_META_1.fields();

0 commit comments

Comments
 (0)