ecformat 0.1.1

command line tool to keep files correct in respect of your EditorConfig
Documentation
// SPDX-FileCopyrightText: Contributors to ecformat project <https://codeberg.org/BaumiCoder/ecformat>
//
// SPDX-License-Identifier: BlueOak-1.0.0

//! Tests for the function [`get_charset_from_file`]

use ec4rs::property::Charset;

use super::super::CharsetHandler;
use crate::test_utils::{TestFileHelper, charset::get_charset_from_file_name};

/// Test on all files from [`get_test_file_paths`].
/// The file names (without extension) have to be the name of the charset of the file.
#[test]
fn test_get_charset_from_file_success() {
    for test_entry in TestFileHelper::new::<Charset>().get_test_file_paths() {
        let result = CharsetHandler::get_charset_from_file(&test_entry)
            .expect("Read for get charset needs to be possible")
            .expect("Charset was not determinable");
        let expected_charset = get_charset_from_file_name(&test_entry);
        assert_eq!(result, expected_charset);
    }
}