<commit_before>//
//  TagSpec.swift
//  Ello
//
//  Created by <NAME> on 7/31/2015.
//  Copyright (c) 2015 Ello. All rights reserved.
//

import Quick
import Nimble
import Ello


class TagSpec: QuickSpec {
    override func spec() {
        describe("Tag") {
            context("parsing HTML") {
                let tests: [String: (input: String, output: String)] = [
                    "break tags": (input: "test<br><br />", output: "test<br /><br />"),
                    "break tags in a p tag": (input: "<p>test<br><br />", output: "<p>test<br /><br /></p>"),
                    "entities": (input: "&lt;tag!&gt;that is a tag&lt;/tag&gt;", output: "&lt;tag!&gt;that is a tag&lt;/tag&gt;"),
                    "link": (input: "test <a href=\"foo.com\">a link</a>", output: "test <a href=\"foo.com\">a link</a>"),
                    "styled text": (input: "test <b>bold</b> <i>italic</i> <strong>strong</strong> <em>emphasis</em>", output: "test <b>bold</b> <i>italic</i> <strong>strong</strong> <em>emphasis</em>")
                ]
                for (name, spec) in tests {
                    it("should parse \(name)") {
                        let text = Tag(input: spec.input)
                        expect(text!.description) == spec.output
                    }
                }
            }

            fcontext("rendering NSAttributedString") {
                let tests: [String: (input: String, output: String)] = [
                    "break tags": (input: "test<br><br />", output: "test\n\n"),
                    "new lines": (input: " test\ntest  \n\n  test\t", output: " test\ntest  \n\n  test\t"),
                    "break tags in a p tag": (input: "<p>test<br><br />", output: "test\n\n"),
                    "entities": (input: "&lt;tag!&gt;that is a tag&lt;/tag&gt;", output: "<tag!>that is a tag</tag>"),
                    "link": (input: "test <a href=\"foo.com\">a link</a>", output: "test [a link](foo.com)"),
                    "styled text": (input: "test <b>bold</b> <i>italic</i> <strong>strong</strong> <em>emphasis</em>", output: "test bold italic strong emphasis")
                ]
                for (name, spec) in tests {
                    it("should render \(name)") {
                        let tag = Tag(input: spec.input)
                        let output = tag!.makeEditable().string.stringByReplacingOccurrencesOfString("\n", withString: "\\n").stringByReplacingOccurrencesOfString("\t", withString: "\\t")
                        let expected = spec.output.stringByReplacingOccurrencesOfString("\n", withString: "\\n").stringByReplacingOccurrencesOfString("\t", withString: "\\t")
                        expect(output) == expected
                    }
                }
            }

        }
    }
}
<commit_msg>unfocus test<commit_after>//
//  TagSpec.swift
//  Ello
//
//  Created by <NAME> on 7/31/2015.
//  Copyright (c) 2015 Ello. All rights reserved.
//

import Quick
import Nimble
import Ello


class TagSpec: QuickSpec {
    override func spec() {
        describe("Tag") {
            context("parsing HTML") {
                let tests: [String: (input: String, output: String)] = [
                    "break tags": (input: "test<br><br />", output: "test<br /><br />"),
                    "break tags in a p tag": (input: "<p>test<br><br />", output: "<p>test<br /><br /></p>"),
                    "entities": (input: "&lt;tag!&gt;that is a tag&lt;/tag&gt;", output: "&lt;tag!&gt;that is a tag&lt;/tag&gt;"),
                    "link": (input: "test <a href=\"foo.com\">a link</a>", output: "test <a href=\"foo.com\">a link</a>"),
                    "styled text": (input: "test <b>bold</b> <i>italic</i> <strong>strong</strong> <em>emphasis</em>", output: "test <b>bold</b> <i>italic</i> <strong>strong</strong> <em>emphasis</em>")
                ]
                for (name, spec) in tests {
                    it("should parse \(name)") {
                        let text = Tag(input: spec.input)
                        expect(text!.description) == spec.output
                    }
                }
            }

            context("rendering NSAttributedString") {
                let tests: [String: (input: String, output: String)] = [
                    "break tags": (input: "test<br><br />", output: "test\n\n"),
                    "new lines": (input: " test\ntest  \n\n  test\t", output: " test\ntest  \n\n  test\t"),
                    "break tags in a p tag": (input: "<p>test<br><br />", output: "test\n\n"),
                    "entities": (input: "&lt;tag!&gt;that is a tag&lt;/tag&gt;", output: "<tag!>that is a tag</tag>"),
                    "link": (input: "test <a href=\"foo.com\">a link</a>", output: "test [a link](foo.com)"),
                    "styled text": (input: "test <b>bold</b> <i>italic</i> <strong>strong</strong> <em>emphasis</em>", output: "test bold italic strong emphasis")
                ]
                for (name, spec) in tests {
                    it("should render \(name)") {
                        let tag = Tag(input: spec.input)
                        let output = tag!.makeEditable().string.stringByReplacingOccurrencesOfString("\n", withString: "\\n").stringByReplacingOccurrencesOfString("\t", withString: "\\t")
                        let expected = spec.output.stringByReplacingOccurrencesOfString("\n", withString: "\\n").stringByReplacingOccurrencesOfString("\t", withString: "\\t")
                        expect(output) == expected
                    }
                }
            }

        }
    }
}

{'fraction_non_alphanumeric': 0.1826992103374013, 'fraction_numerical': 0.003948312993539124, 'mean_word_length': 1.7865, 'pattern_counts': {'":': 22, '<': 101, '<?xml version=': 0, '>': 101, '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': '4772170', 'n_tokens_mistral': 1784, 'n_tokens_neox': 1667, 'n_words': 409}