Commit fff50e7d authored by Wohlgemuth, Jason's avatar Wohlgemuth, Jason
Browse files

feat: Rename get_checksum to checksum

parent af2d3f25
Loading
Loading
Loading
Loading
+30 −30
Original line number Diff line number Diff line
@@ -451,13 +451,13 @@ DA:402,0
DA:404,3
DA:405,6
DA:406,6
DA:407,1
DA:407,3
DA:408,0
DA:410,2
DA:411,1
DA:412,0
DA:416,3
DA:417,2
DA:416,6
DA:417,3
DA:419,0
DA:420,0
DA:428,1
@@ -467,10 +467,10 @@ DA:432,0
DA:433,0
DA:436,5
DA:437,4
DA:438,5
DA:438,8
DA:439,0
DA:441,4
DA:442,3
DA:441,8
DA:442,4
DA:449,1
DA:450,2
DA:451,1
@@ -695,7 +695,7 @@ DA:300,1
DA:301,2
DA:302,1
DA:303,2
DA:304,5
DA:304,3
DA:306,4
DA:307,2
DA:310,0
@@ -920,22 +920,22 @@ DA:758,0
DA:762,1
DA:763,1
DA:764,1
DA:765,3
DA:766,4
DA:767,3
DA:768,2
DA:769,11
DA:770,4
DA:771,1
DA:772,1
DA:765,2
DA:766,2
DA:767,2
DA:768,1
DA:769,9
DA:770,2
DA:771,2
DA:772,2
DA:773,1
DA:774,2
DA:774,1
DA:779,2
DA:780,2
DA:782,0
DA:783,0
DA:786,1
DA:787,1
DA:786,2
DA:787,2
DA:788,2
DA:789,2
DA:792,2
@@ -998,7 +998,7 @@ DA:922,0
DA:932,1
DA:934,1
DA:941,1
DA:942,4
DA:942,5
DA:943,3
DA:948,1
DA:949,2
@@ -1016,8 +1016,8 @@ DA:1013,1
DA:1014,2
DA:1015,1
DA:1016,0
DA:1018,6
DA:1019,2
DA:1018,3
DA:1019,1
DA:1023,1
DA:1024,1
DA:1025,2
@@ -1070,8 +1070,8 @@ FNDA:0,Label::pass
FNDA:0,Label::read
FNDA:0,Label::rejected
FNDA:0,Label::run
FNDA:3,Label::using
FNDA:3,Label::fmt_using
FNDA:4,Label::using
FNDA:4,Label::fmt_using
FNDA:1,add_dot_slash
FNDA:1,add_forward_slash
FNDA:0,download_binary
@@ -1115,11 +1115,11 @@ DA:71,0
DA:73,0
DA:74,0
DA:75,0
DA:77,3
DA:78,1
DA:80,3
DA:81,1
DA:82,3
DA:77,4
DA:78,4
DA:80,4
DA:81,4
DA:82,4
DA:86,1
DA:87,2
DA:88,2
@@ -1178,10 +1178,10 @@ DA:236,1
DA:238,2
DA:251,2
DA:252,2
DA:253,4
DA:253,6
DA:254,3
DA:255,6
DA:256,6
DA:256,7
DA:258,1
DA:259,2
DA:260,1
+2 −2
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ use tracing::{debug, error, info, warn};
use uriparse::Scheme;

use crate::script::*;
use crate::util::*;
use crate::util::{self, download_binary, get_children, get_extension, make_executable, path_to_string, read_file, snake_case, Label};

enum Extension {
    Json,
@@ -205,7 +205,7 @@ impl Config {
                            };
                            if !options.skip_verify_checksum.unwrap_or_default() {
                                let calculated_checksum = match output.clone() {
                                    | Ok(path) => get_checksum(path),
                                    | Ok(path) => util::checksum(path),
                                    | _ => "".to_string(),
                                };
                                match checksum {
+6 −6
Original line number Diff line number Diff line
@@ -147,19 +147,19 @@ fn test_details() {
    assert_eq!(results.len(), 5);
}
#[test]
fn test_get_checksum() {
    let checksum = get_checksum(PathBuf::from("../LICENSE"));
fn test_checksum() {
    let result = checksum(PathBuf::from("../LICENSE"));
    if cfg!(target_os = "windows") {
        assert_eq!(checksum.len(), 64);
        assert_eq!(result.len(), 64);
    } else {
        let expected = "debe0f22e2b4e8dffd88d4bbe8b15cca98c5950b1b857d1747f211465fba972e";
        assert_eq!(checksum, expected);
        assert_eq!(result, expected);
    }
}
#[test]
#[should_panic]
fn test_get_checksum_panic() {
    assert_eq!(get_checksum(PathBuf::from("/path/does/not/exist.txt")), "");
fn test_checksum_panic() {
    assert_eq!(checksum(PathBuf::from("/path/does/not/exist.txt")), "");
}
#[test]
fn test_get_children() {
+1 −1
Original line number Diff line number Diff line
@@ -169,7 +169,7 @@ pub fn get_conda_environment_name(path: PathBuf) -> Option<String> {
    }
}
/// Get SHA256 hash of a file
pub fn get_checksum(path: PathBuf) -> String {
pub fn checksum(path: PathBuf) -> String {
    if let Ok(content) = read_file(path) {
        let hash = Sha256::digest(content);
        format!("{hash:x}")