e9571_config-reader 0.1.1

A simple Rust crate to read config.json from executable directory
Documentation
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::path::Path;
use serde_json;

// 读取 config.json 并解析为 HashMap<String, String

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_read_config() {
        // 测试需要 config.json 存在,建议在测试前创建
        match read_config() {
            Ok(config) => {
                assert!(config.contains_key("apiURL"));
                assert!(config.contains_key("apiKey"));
            }
            Err(e) => panic!("Test failed: {}", e),
        }
    }
}