Skip to content

Commit ccef24a

Browse files
committed
Tests: Use test-log in TagLib tests
1 parent c59fb4b commit ccef24a

20 files changed

+304
-294
lines changed

lofty/tests/taglib/test_aiff.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use lofty::iff::aiff::{AiffCompressionType, AiffFile};
1010
use lofty::probe::Probe;
1111
use lofty::tag::{Accessor, TagType};
1212

13-
#[test]
13+
#[test_log::test]
1414
fn test_aiff_properties() {
1515
let file = get_file::<AiffFile>("tests/taglib/data/empty.aiff");
1616

@@ -26,7 +26,7 @@ fn test_aiff_properties() {
2626
assert!(properties.compression_type().is_none());
2727
}
2828

29-
#[test]
29+
#[test_log::test]
3030
fn test_aifc_properties() {
3131
let file = get_file::<AiffFile>("tests/taglib/data/alaw.aifc");
3232

@@ -55,7 +55,7 @@ fn test_aifc_properties() {
5555
);
5656
}
5757

58-
#[test]
58+
#[test_log::test]
5959
fn test_save_id3v2() {
6060
let mut file = temp_file!("tests/taglib/data/empty.aiff");
6161

@@ -95,19 +95,19 @@ fn test_save_id3v2() {
9595
}
9696
}
9797

98-
#[test]
98+
#[test_log::test]
9999
#[ignore]
100100
fn test_save_id3v23() {
101101
todo!("Support writing ID3v2.3 tags")
102102
}
103103

104-
#[test]
104+
#[test_log::test]
105105
#[ignore]
106106
fn test_duplicate_id3v2() {
107107
// Marker test, Lofty will overwrite values in the original tag with any new values it finds in the next tag.
108108
}
109109

110-
#[test]
110+
#[test_log::test]
111111
fn test_fuzzed_file1() {
112112
assert_eq!(
113113
Probe::open("tests/taglib/data/segfault.aif")
@@ -119,7 +119,7 @@ fn test_fuzzed_file1() {
119119
);
120120
}
121121

122-
#[test]
122+
#[test_log::test]
123123
#[ignore]
124124
fn test_fuzzed_file2() {
125125
// Marker test, this file doesn't even have a valid signature. No idea how TagLib manages to read it.

lofty/tests/taglib/test_ape.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ fn test_399(path: &str) {
2525
assert_eq!(properties.version(), 3990)
2626
}
2727

28-
#[test]
28+
#[test_log::test]
2929
fn test_properties_399() {
3030
test_399("tests/taglib/data/mac-399.ape")
3131
}
3232

33-
#[test]
33+
#[test_log::test]
3434
fn test_properties_399_tagged() {
3535
test_399("tests/taglib/data/mac-399-tagged.ape")
3636
}
3737

38-
#[test]
38+
#[test_log::test]
3939
fn test_properties_399_id3v2() {
4040
test_399("tests/taglib/data/mac-399-id3v2.ape")
4141
}
4242

43-
#[test]
43+
#[test_log::test]
4444
fn test_properties_396() {
4545
let f = get_file::<ApeFile>("tests/taglib/data/mac-396.ape");
4646
let properties = f.properties();
@@ -55,7 +55,7 @@ fn test_properties_396() {
5555
assert_eq!(properties.version(), 3960)
5656
}
5757

58-
#[test]
58+
#[test_log::test]
5959
fn test_properties_390() {
6060
let f = get_file::<ApeFile>("tests/taglib/data/mac-390-hdr.ape");
6161
let properties = f.properties();
@@ -70,7 +70,7 @@ fn test_properties_390() {
7070
assert_eq!(properties.version(), 3900)
7171
}
7272

73-
#[test]
73+
#[test_log::test]
7474
fn test_fuzzed_file_1() {
7575
assert_eq!(
7676
Probe::open("tests/taglib/data/longloop.ape")
@@ -82,7 +82,7 @@ fn test_fuzzed_file_1() {
8282
);
8383
}
8484

85-
#[test]
85+
#[test_log::test]
8686
fn test_fuzzed_file_2() {
8787
assert_eq!(
8888
Probe::open("tests/taglib/data/zerodiv.ape")
@@ -94,7 +94,7 @@ fn test_fuzzed_file_2() {
9494
);
9595
}
9696

97-
#[test]
97+
#[test_log::test]
9898
fn test_strip_and_properties() {
9999
let mut file = temp_file!("tests/taglib/data/mac-399.ape");
100100
{
@@ -127,7 +127,7 @@ fn test_strip_and_properties() {
127127
}
128128
}
129129

130-
#[test]
130+
#[test_log::test]
131131
fn test_properties() {
132132
let mut tag = ApeTag::default();
133133
tag.insert(
@@ -356,7 +356,7 @@ fn test_properties() {
356356
}
357357
}
358358

359-
#[test]
359+
#[test_log::test]
360360
fn test_repeated_save() {
361361
let mut file = temp_file!("tests/taglib/data/mac-399.ape");
362362
{

lofty/tests/taglib/test_apetag.rs

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use lofty::file::AudioFile;
88
use lofty::musepack::MpcFile;
99
use lofty::tag::{Accessor, ItemValue, TagExt};
1010

11-
#[test]
11+
#[test_log::test]
1212
fn test_is_empty() {
1313
let mut tag = ApeTag::default();
1414
assert!(tag.is_empty());
@@ -22,49 +22,55 @@ fn test_is_empty() {
2222
assert!(!tag.is_empty());
2323
}
2424

25-
#[test]
25+
#[test_log::test]
2626
fn test_is_empty_2() {
2727
let mut tag = ApeTag::default();
2828
assert!(tag.is_empty());
2929
tag.set_artist(String::from("Mike Oldfield"));
3030
assert!(!tag.is_empty());
3131
}
3232

33-
#[test]
33+
#[test_log::test]
3434
#[ignore]
3535
fn test_property_interface_1() {
3636
// Marker test, Lofty does not replicate the TagLib property API
3737
}
3838

39-
#[test]
39+
#[test_log::test]
4040
#[ignore]
4141
fn test_property_interface_2() {
4242
// Marker test, Lofty does not replicate the TagLib property API
4343
}
4444

45-
#[test]
45+
#[test_log::test]
4646
fn test_invalid_keys() {
4747
static INVALID_KEY_ONE_CHARACTER: &str = "A";
4848
static INVALID_KEY_FORBIDDEN_STRING: &str = "MP+";
4949
static INVALID_KEY_UNICODE: &str = "\x1234\x3456";
5050
static VALID_KEY_SPACE_AND_TILDE: &str = "A B~C";
5151
static VALID_KEY_NORMAL_ONE: &str = "ARTIST";
5252

53-
assert!(ApeItem::new(
54-
String::from(INVALID_KEY_ONE_CHARACTER),
55-
ItemValue::Text(String::from("invalid key: one character"))
56-
)
57-
.is_err());
58-
assert!(ApeItem::new(
59-
String::from(INVALID_KEY_FORBIDDEN_STRING),
60-
ItemValue::Text(String::from("invalid key: forbidden string"))
61-
)
62-
.is_err());
63-
assert!(ApeItem::new(
64-
String::from(INVALID_KEY_UNICODE),
65-
ItemValue::Text(String::from("invalid key: Unicode"))
66-
)
67-
.is_err());
53+
assert!(
54+
ApeItem::new(
55+
String::from(INVALID_KEY_ONE_CHARACTER),
56+
ItemValue::Text(String::from("invalid key: one character"))
57+
)
58+
.is_err()
59+
);
60+
assert!(
61+
ApeItem::new(
62+
String::from(INVALID_KEY_FORBIDDEN_STRING),
63+
ItemValue::Text(String::from("invalid key: forbidden string"))
64+
)
65+
.is_err()
66+
);
67+
assert!(
68+
ApeItem::new(
69+
String::from(INVALID_KEY_UNICODE),
70+
ItemValue::Text(String::from("invalid key: Unicode"))
71+
)
72+
.is_err()
73+
);
6874

6975
let valid_space_and_tilde = ApeItem::new(
7076
String::from(VALID_KEY_SPACE_AND_TILDE),
@@ -84,15 +90,15 @@ fn test_invalid_keys() {
8490
assert_eq!(tag.len(), 2);
8591
}
8692

87-
#[test]
93+
#[test_log::test]
8894
#[ignore]
8995
fn test_text_binary() {
9096
// Marker test, this is useless as Lofty does not have a similar API that the test is based upon:
9197
// https://github.com/taglib/taglib/blob/a31356e330674640a07bef7d71d08242cae8e9bf/tests/test_apetag.cpp#L153
9298
}
9399

94100
// TODO: Does not work! We fall for this collision.
95-
#[test]
101+
#[test_log::test]
96102
#[ignore]
97103
fn test_id3v1_collision() {
98104
let mut file = temp_file!("tests/taglib/data/no-tags.mpc");

0 commit comments

Comments
 (0)