mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-07 12:05:46 +00:00
move module tests
to end of file
This commit is contained in:
parent
aad55e6102
commit
7f763ff500
@ -170,6 +170,21 @@ pub fn extensions_from_path(path: &Path) -> Vec<Extension> {
|
|||||||
extensions
|
extensions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Panics if formats has an empty list of compression formats
|
||||||
|
pub fn split_first_compression_format(formats: &[Extension]) -> (CompressionFormat, Vec<CompressionFormat>) {
|
||||||
|
let mut extensions: Vec<CompressionFormat> = flatten_compression_formats(formats);
|
||||||
|
let first_extension = extensions.remove(0);
|
||||||
|
(first_extension, extensions)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn flatten_compression_formats(extensions: &[Extension]) -> Vec<CompressionFormat> {
|
||||||
|
extensions
|
||||||
|
.iter()
|
||||||
|
.flat_map(|extension| extension.compression_formats.iter())
|
||||||
|
.copied()
|
||||||
|
.collect()
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
@ -185,18 +200,3 @@ mod tests {
|
|||||||
assert_eq!(formats, vec![Tar, Gzip]);
|
assert_eq!(formats, vec![Tar, Gzip]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Panics if formats has an empty list of compression formats
|
|
||||||
pub fn split_first_compression_format(formats: &[Extension]) -> (CompressionFormat, Vec<CompressionFormat>) {
|
|
||||||
let mut extensions: Vec<CompressionFormat> = flatten_compression_formats(formats);
|
|
||||||
let first_extension = extensions.remove(0);
|
|
||||||
(first_extension, extensions)
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn flatten_compression_formats(extensions: &[Extension]) -> Vec<CompressionFormat> {
|
|
||||||
extensions
|
|
||||||
.iter()
|
|
||||||
.flat_map(|extension| extension.compression_formats.iter())
|
|
||||||
.copied()
|
|
||||||
.collect()
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user