Added more fields #18

Merged
phoenix merged 2 commits from expand_properties into devel 2025-04-15 00:49:51 +00:00
Showing only changes of commit 4cc4421a13 - Show all commits

View File

@@ -78,15 +78,28 @@ mod tests {
Ok(dir_path.join(filename))
}
pub fn test_file_directory() -> String {
String::from("tests/sample_tracks3")
pub const TESTFILEDIRECTORY: &str = "tests/sample_tracks3";
pub fn get_filename(track: i32) -> String {
let mut filename = String::from("track");
if track < 10 {
filename += "0";
filename += &track.to_string();
} else {
filename += &track.to_string();
}
filename += ".flac";
filename
}
}
#[test]
fn test_get_title() {
let filename = String::from("track01.flac");
let dir = util::test_file_directory();
let filename = util::get_filename(1);
let dir = String::from(util::TESTFILEDIRECTORY);
match file_exists(&dir, &filename) {
Ok(_) => {
@@ -110,8 +123,8 @@ mod tests {
#[test]
fn test_get_artist() {
let filename = String::from("track01.flac");
let dir = util::test_file_directory();
let filename = util::get_filename(1);
let dir = String::from(util::TESTFILEDIRECTORY);
match file_exists(&dir, &filename) {
Ok(_) => {
@@ -135,8 +148,8 @@ mod tests {
#[test]
fn test_get_album() {
let filename = String::from("track01.flac");
let dir = util::test_file_directory();
let filename = util::get_filename(1);
let dir = String::from(util::TESTFILEDIRECTORY);
match file_exists(&dir, &filename) {
Ok(_) => {
@@ -160,8 +173,8 @@ mod tests {
#[test]
fn test_get_album_artist() {
let filename = String::from("track01.flac");
let dir = util::test_file_directory();
let filename = util::get_filename(1);
let dir = String::from(util::TESTFILEDIRECTORY);
match file_exists(&dir, &filename) {
Ok(_) => {
@@ -185,8 +198,8 @@ mod tests {
#[test]
fn test_get_genre() {
let filename = String::from("track01.flac");
let dir = util::test_file_directory();
let filename = util::get_filename(1);
let dir = String::from(util::TESTFILEDIRECTORY);
match file_exists(&dir, &filename) {
Ok(_) => {
@@ -209,8 +222,8 @@ mod tests {
}
#[test]
fn test_get_year() {
let filename = String::from("track01.flac");
let dir = util::test_file_directory();
let filename = util::get_filename(1);
let dir = String::from(util::TESTFILEDIRECTORY);
match file_exists(&dir, &filename) {
Ok(_) => {
@@ -234,8 +247,8 @@ mod tests {
#[test]
fn test_get_track() {
let filename = String::from("track01.flac");
let dir = util::test_file_directory();
let filename = util::get_filename(1);
let dir = String::from(util::TESTFILEDIRECTORY);
match file_exists(&dir, &filename) {
Ok(_) => {
@@ -259,8 +272,8 @@ mod tests {
#[test]
fn test_get_disc() {
let filename = String::from("track01.flac");
let dir = util::test_file_directory();
let filename = util::get_filename(1);
let dir = String::from(util::TESTFILEDIRECTORY);
match file_exists(&dir, &filename) {
Ok(_) => {