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 [`read_file`]

use ec4rs::property::Charset;

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

use super::super::read_file;

/// Test on all files from [`get_test_file_paths`] of `charset`.
/// The file names (without extension) have to be the name of the charset of the file.
#[test]
fn test_read_file_charset() {
    for test_entry in TestFileHelper::new::<Charset>().get_test_file_paths() {
        let charset =
            get_charset_from_file_name(&test_entry).expect("Needs to be a supported charset");
        let content = read_file(&test_entry, &charset).expect("File needs to be readable");

        assert!(
            content.contains("º ü é Ä ³ µ"),
            "Special characters not correctly read"
        );
    }
}