<commit_before><html>
    <body>

        <textarea class="tempest-template" title="template-message" style="display:none;">
            <li>{{name}} says "{{message}}"</li>
        </textarea>
        <textarea class="tempest-template" title="template-web-things" style="display:none;">
            <li>{{name}} is a {{type}} at {{url}}</li>
        </textarea>
        <textarea class="tempest-template" title="if-template" style="display:none;">
            <li>hello {% if t %}world{% endif %}</li>
        </textarea>

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
        <script type="text/javascript" src="jquery.tempest.js"></script>
        <script type="text/javascript">
        $(document).ready(function(){

            function testStorageFromTextarea(){
                var templ1 = $.tempest("template-message") == "<li>{{name}} says \"{{message}}\"</li>";
                var templ2 = $.tempest("template-web-things") == "<li>{{name}} is a {{type}} at {{url}}</li>";
                return templ1 == true && templ2 == true;
            }
            fireunit.ok(testStorageFromTextarea(), "Access stored templates that were inside textareas");

            function testGetAllTemplatesLength(){
                return $.tempest().length == 3;
            }
            fireunit.ok(testGetAllTemplatesLength(), "Length of $.tempest() is equal to number of textarea templates pre-defined");

            function testGetAllTemplatesKeys(){
                var first = $.tempest()[0];
                var second = $.tempest()[1];
                var first_correct = first[0] == "template-message" || first[0] == "template-web-things";
                var second_correct = second[0] == "template-message" || second[0] == "template-web-things";
                return first_correct && second_correct && first[0] != second[0];
            }
            fireunit.ok(testGetAllTemplatesKeys(), "Keys to existing templates are in $.tempest()");

            function testGetAllTemplatesVals(){
                var first = $.tempest()[0];
                var second = $.tempest()[1];
                var first_correct = first[1] == $.tempest("template-message") || first[1] == $.tempest("template-web-things");
                var second_correct = second[1] == $.tempest("template-message") || second[1] == $.tempest("template-web-things");
                return first_correct && second_correct && first[1] != second[1];
            }
            fireunit.ok(testGetAllTemplatesVals(), "Existing templates are in $.tempest()");

            function testSetTemplate(){
                var tmpl = "Hello {{variable}}";
                return $.tempest("hello", tmpl) == tmpl;
            }
            fireunit.ok(testSetTemplate(), "Template setter");

            function testGetTemplate(){
                var key = "arbitrary";
                var tmpl = "Hello {{variable}}";
                $.tempest(key, tmpl);
                return $.tempest(key) == tmpl;
            }
            fireunit.ok(testGetTemplate(), "Template getter");

            function testRenderedValue(){
                var obj = {"name":"my site", "type":"blog", "url":"http://fitzgeraldnick.com/"};
                var rendered = $.tempest("template-web-things", obj);
                return rendered.text() == "my site is a blog at http://fitzgeraldnick.com/";
            }
            fireunit.ok(testRenderedValue(), "The text of the rendered template is correct");

            function testAppendSingleObject(){
                var len = $("body ul li").length;
                var message = {name:"nick", message:"hello world"};
                var rendered = $.tempest("template-message", message);
                $("body ul").append(rendered);
                return len + 1 == $("body ul li").length;
            }
            fireunit.ok(testAppendSingleObject(), "Append a single rendered object to the DOM");

            function testManyRenderedValue(){
                var arr = [{name:"mom", message:"brush your teeth"},
                           {name:"heidi", message:"why hello"},
                           {name:"<NAME>", message:"I didn't inhale"},
                           {name:"<NAME>", message:"Oops I did it again"},];
                var text = $.tempest("template-message", arr).text();

                var expected = [];
                for (i = 0; i < arr.length; i++){
                    expected.push($.tempest("template-message", arr[i]).text());
                }
                expected = expected.join("");
                return text == expected;
            }
            fireunit.ok(testManyRenderedValue(), "The text of the rendered template is correct with array of objs");

            function testAppendManyObjects(){
                var len = $("body ul li").length;
                var arr = [{name:"mom", message:"brush your teeth"},
                           {name:"heidi", message:"why hello"},
                           {name:"<NAME>", message:"I didn't inhale"},
                           {name:"<NAME>", message:"Oops I did it again"},];
                var rendered = $.tempest("template-message", arr);
                $("body ul").append(rendered);
                return len + arr.length == $("body ul li").length;
            }
            fireunit.ok(testAppendManyObjects(), "Append an array of rendered objects to the DOM");

            function testRenderOneTimeUseTemplate(){
                var obj = {thing:"test", activity:"TESTS"};
                var tmpl = "<li><em>Whoah a one time use {{thing}} for doing {{activity}}</em></li>";
                var rendered = $.tempest(tmpl, obj);
                return rendered.text() == "Whoah a one time use test for doing TESTS";
            }
            fireunit.ok(testRenderOneTimeUseTemplate(), "Render data to a one-time-use template");

            function testAppendOneTimeUseTemplate(){
                var len = $("body ul li").length;
                var obj = {thing:"test", activity:"TESTS"};
                var tmpl = "<li><em>Whoah a one time use {{thing}} for doing {{activity}}</em></li>";
                var rendered = $.tempest(tmpl, obj);
                $("body ul").append(rendered);
                return len + 1 == $("body ul li").length;
            }
            fireunit.ok(testAppendOneTimeUseTemplate(), "Append data from a rendered one-time-use template");

            function testUnknownInput(){
                try {
                    $.tempest(3242354534534);
                    return false;
                } catch(error) {
                    return error.name === "InputError";
                }
            }
            fireunit.ok(testUnknownInput(), "Unknown input throws an error");

            function testRenderJQuery() {
                var jq = "<div>jQuery object</div>";
                var rendered = $.tempest("template-message", {
                    name: "nick",
                    message: $(jq),
                });
                return rendered.html() == 'nick says "'+jq+'"';
            }
            fireunit.ok(testRenderJQuery(), "Render jQuery objects with their HTML");
<commit_msg>Second time I have had to deal with that bug. Just ok the test if an error is thrown.<commit_after><html>
    <body>

        <textarea class="tempest-template" title="template-message" style="display:none;">
            <li>{{name}} says "{{message}}"</li>
        </textarea>
        <textarea class="tempest-template" title="template-web-things" style="display:none;">
            <li>{{name}} is a {{type}} at {{url}}</li>
        </textarea>
        <textarea class="tempest-template" title="if-template" style="display:none;">
            <li>hello {% if t %}world{% endif %}</li>
        </textarea>

        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js"></script>
        <script type="text/javascript" src="jquery.tempest.js"></script>
        <script type="text/javascript">
        $(document).ready(function(){

            function testStorageFromTextarea(){
                var templ1 = $.tempest("template-message") == "<li>{{name}} says \"{{message}}\"</li>";
                var templ2 = $.tempest("template-web-things") == "<li>{{name}} is a {{type}} at {{url}}</li>";
                return templ1 == true && templ2 == true;
            }
            fireunit.ok(testStorageFromTextarea(), "Access stored templates that were inside textareas");

            function testGetAllTemplatesLength(){
                return $.tempest().length == 3;
            }
            fireunit.ok(testGetAllTemplatesLength(), "Length of $.tempest() is equal to number of textarea templates pre-defined");

            function testGetAllTemplatesKeys(){
                var first = $.tempest()[0];
                var second = $.tempest()[1];
                var first_correct = first[0] == "template-message" || first[0] == "template-web-things";
                var second_correct = second[0] == "template-message" || second[0] == "template-web-things";
                return first_correct && second_correct && first[0] != second[0];
            }
            fireunit.ok(testGetAllTemplatesKeys(), "Keys to existing templates are in $.tempest()");

            function testGetAllTemplatesVals(){
                var first = $.tempest()[0];
                var second = $.tempest()[1];
                var first_correct = first[1] == $.tempest("template-message") || first[1] == $.tempest("template-web-things");
                var second_correct = second[1] == $.tempest("template-message") || second[1] == $.tempest("template-web-things");
                return first_correct && second_correct && first[1] != second[1];
            }
            fireunit.ok(testGetAllTemplatesVals(), "Existing templates are in $.tempest()");

            function testSetTemplate(){
                var tmpl = "Hello {{variable}}";
                return $.tempest("hello", tmpl) == tmpl;
            }
            fireunit.ok(testSetTemplate(), "Template setter");

            function testGetTemplate(){
                var key = "arbitrary";
                var tmpl = "Hello {{variable}}";
                $.tempest(key, tmpl);
                return $.tempest(key) == tmpl;
            }
            fireunit.ok(testGetTemplate(), "Template getter");

            function testRenderedValue(){
                var obj = {"name":"my site", "type":"blog", "url":"http://fitzgeraldnick.com/"};
                var rendered = $.tempest("template-web-things", obj);
                return rendered.text() == "my site is a blog at http://fitzgeraldnick.com/";
            }
            fireunit.ok(testRenderedValue(), "The text of the rendered template is correct");

            function testAppendSingleObject(){
                var len = $("body ul li").length;
                var message = {name:"nick", message:"hello world"};
                var rendered = $.tempest("template-message", message);
                $("body ul").append(rendered);
                return len + 1 == $("body ul li").length;
            }
            fireunit.ok(testAppendSingleObject(), "Append a single rendered object to the DOM");

            function testManyRenderedValue(){
                var arr = [{name:"mom", message:"brush your teeth"},
                           {name:"heidi", message:"why hello"},
                           {name:"<NAME>", message:"I didn't inhale"},
                           {name:"<NAME>", message:"Oops I did it again"},];
                var text = $.tempest("template-message", arr).text();

                var expected = [];
                for (i = 0; i < arr.length; i++){
                    expected.push($.tempest("template-message", arr[i]).text());
                }
                expected = expected.join("");
                return text == expected;
            }
            fireunit.ok(testManyRenderedValue(), "The text of the rendered template is correct with array of objs");

            function testAppendManyObjects(){
                var len = $("body ul li").length;
                var arr = [{name:"mom", message:"brush your teeth"},
                           {name:"heidi", message:"why hello"},
                           {name:"<NAME>", message:"I didn't inhale"},
                           {name:"<NAME>", message:"Oops I did it again"},];
                var rendered = $.tempest("template-message", arr);
                $("body ul").append(rendered);
                return len + arr.length == $("body ul li").length;
            }
            fireunit.ok(testAppendManyObjects(), "Append an array of rendered objects to the DOM");

            function testRenderOneTimeUseTemplate(){
                var obj = {thing:"test", activity:"TESTS"};
                var tmpl = "<li><em>Whoah a one time use {{thing}} for doing {{activity}}</em></li>";
                var rendered = $.tempest(tmpl, obj);
                return rendered.text() == "Whoah a one time use test for doing TESTS";
            }
            fireunit.ok(testRenderOneTimeUseTemplate(), "Render data to a one-time-use template");

            function testAppendOneTimeUseTemplate(){
                var len = $("body ul li").length;
                var obj = {thing:"test", activity:"TESTS"};
                var tmpl = "<li><em>Whoah a one time use {{thing}} for doing {{activity}}</em></li>";
                var rendered = $.tempest(tmpl, obj);
                $("body ul").append(rendered);
                return len + 1 == $("body ul li").length;
            }
            fireunit.ok(testAppendOneTimeUseTemplate(), "Append data from a rendered one-time-use template");

            function testUnknownInput(){
                try {
                    $.tempest(3242354534534);
                    return false;
                } catch(error) {
                    return true;
                }
            }
            fireunit.ok(testUnknownInput(), "Unknown input throws an error");

            function testRenderJQuery() {
                var jq = "<div>jQuery object</div>";
                var rendered = $.tempest("template-message", {
                    name: "nick",
                    message: $(jq),
                });
                return rendered.html() == 'nick says "'+jq+'"';
            }
            fireunit.ok(testRenderJQuery(), "Render jQuery objects with their HTML");

{'fraction_non_alphanumeric': 0.14963177094087687, 'fraction_numerical': 0.005230917475394039, 'mean_word_length': 1.8557389937106918, 'pattern_counts': {'":': 6, '<': 79, '<?xml version=': 0, '>': 77, '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': '3068799', 'n_tokens_mistral': 3860, 'n_tokens_neox': 3579, 'n_words': 953}