<commit_before>//
//  NSBundleTests.swift
//  MHLocalizationKit
//
//  Created by <NAME> on 3/9/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import XCTest

class NSBundleTests: XCTestCase {
    
    override func setUp() {
        
        super.setUp()
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        super.tearDown()
    }
    
    func testExample() {
        
        // This is an example of a functional test case.
        // Use XCTAssert and related functions to verify your tests produce the correct results.
    }
    
    func testPerformanceExample() {
        
        // This is an example of a performance test case.
        
        self.measureBlock {
            
            // Put the code you want to measure the time of here.
        }
    }
    
}<commit_msg>- added some tests for language bundles<commit_after>//
//  NSBundleTests.swift
//  MHLocalizationKit
//
//  Created by <NAME> on 3/9/16.
//  Copyright © 2016 <NAME>. All rights reserved.
//

import XCTest

class NSBundleTests: XCTestCase {
    
    override func setUp() {
        
        super.setUp()
        
        NSBundle.language = nil
        
        // Put setup code here. This method is called before the invocation of each test method in the class.
    }
    
    override func tearDown() {
        
        // Put teardown code here. This method is called after the invocation of each test method in the class.
        
        NSBundle.language = nil
        
        super.tearDown()
    }
    
    func testDefaultConfig() {
        
        XCTAssertNil(NSBundle.language)
        NSBundle.language = "bg"
        XCTAssertEqual(NSBundle.language, "bg")
    }
    
    //supported languages should resolve to .lproj folders - we will test only some of them
    func testSupportedLanguageBundle() {

        {
            $0.forEach {
                
                XCTAssertEqual(NSBundle(forClass: self.dynamicType).bundleForLanguage($0).bundleURL.lastPathComponent, "\($0.id).lproj")
            }
            
        }(["en", "en-US", "en_US", "en-GB", "bg", "az-Cyrl-AZ", "az-Cyrl", "az-AZ", "az"])
    }
    
    //non supported languages should resolve to the main bundle
    func testNonSupportedLanguageBundles() {
        
        {
            $0.forEach {
                
                XCTAssertEqual(NSBundle(forClass: self.dynamicType).bundleForLanguage($0), NSBundle(forClass: self.dynamicType))
            }
            
        }(["fr", "nonExistingLanguage"])
    }
}
{'fraction_non_alphanumeric': 0.09416058394160584, 'fraction_numerical': 0.007664233576642336, 'mean_word_length': 1.752008032128514, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3619014', 'n_tokens_mistral': 792, 'n_tokens_neox': 759, 'n_words': 239}