<commit_before><xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:f="http://orbeon.org/oxf/xml/formatting"
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
            xmlns:widget="http://orbeon.org/oxf/xml/widget"
            xmlns:ev="http://www.w3.org/2001/xml-events"
            xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xhtml:head>
        <xhtml:title>Test Base Paths</xhtml:title>
        <xforms:model id="mymodel">
            <xforms:instance id="instance1" xmlns="">
                <instance1>
                    <first-name/>
                </instance1>
            </xforms:instance>
            <xforms:instance id="instance2" xmlns="">
                <instance2>
                    <last-name/>
                </instance2>
            </xforms:instance>

            <xforms:bind nodeset="instance('instance1')">
                <xforms:bind nodeset="//*" readonly="true()"/>
            </xforms:bind>

        </xforms:model>

        <xhtml:link type="text/css" rel="stylesheet" href="/ops/yui/logger/assets/logger.css"/>
        <xhtml:script type="text/javascript" src="/ops/yui/logger/logger.js"/>
        <xhtml:script type="text/javascript" src="/ops/yui/yuitest/yuitest.js"/>
        <xhtml:script type="text/javascript">
            <![CDATA[
                YAHOO.tool.TestRunner.add(new YAHOO.tool.TestCase({

                    name: "Test xforms.js algorithm to set base paths",

                    setUp : function () {
                        this.resourcesBaseURL = ORBEON.xforms.Globals.resourcesBaseURL;
                        this.xformsServerURL = ORBEON.xforms.Globals.xformsServerURL;

                        this.dummyScript1 = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(this.dummyScript1, "src", "/orbeon/foobar");

                        this.dummyScript2 = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(this.dummyScript2, "src", "/other/file.js");
                    },

                    tearDown : function () {
                        ORBEON.xforms.Globals.resourcesBaseURL = this.resourcesBaseURL;
                        ORBEON.xforms.Globals.xformsServerURL = this.xformsServerURL;
                    },

                    // Tests with a non-empty context
                    testBasePath1: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/orbeon/ops/javascript/xforms-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, false);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/orbeon");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/orbeon/xforms-server");
                    },

                    testBasePath2: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/orbeon/xforms-server/xforms-foobar-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, false);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/orbeon");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/orbeon/xforms-server");
                    },

                    testBasePath3: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/orbeon/3.1415/ops/javascript/xforms-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, true);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/orbeon/3.1415");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/orbeon/xforms-server");
                    },

                    testBasePath4: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/orbeon/xforms-server/3.1415/xforms-foobar-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, true);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/orbeon/3.1415");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/orbeon/xforms-server");
                    },
                    // Tests with an empty context
                    testBasePath5: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/ops/javascript/xforms-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, false);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/xforms-server");
                    },

                    testBasePath6: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/xforms-server/xforms-foobar-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, false);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/xforms-server");
                    },

                    testBasePath7: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/3.1415/ops/javascript/xforms-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, true);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/3.1415");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/xforms-server");
                    },

                    testBasePath8: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/xforms-server/3.1415/xforms-foobar-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, true);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/3.1415");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/xforms-server");
                    },
                }));
                ORBEON.xforms.Events.orbeonLoadedEvent.subscribe(function() {
                    if (parent && parent.TestManager) {
                        parent.TestManager.load();
                    } else {
                        new YAHOO.tool.TestLogger();
                        YAHOO.tool.TestRunner.run();
                    }
                });
            ]]>
        </xhtml:script>

    </xhtml:head>
    <xhtml:body>
        <xhtml:p>See log window for test results.</xhtml:p>
    </xhtml:body>
</xhtml:html><commit_msg>Removed extra comma.<commit_after><xhtml:html xmlns:xforms="http://www.w3.org/2002/xforms"
            xmlns:f="http://orbeon.org/oxf/xml/formatting"
            xmlns:xhtml="http://www.w3.org/1999/xhtml"
            xmlns:xxforms="http://orbeon.org/oxf/xml/xforms"
            xmlns:widget="http://orbeon.org/oxf/xml/widget"
            xmlns:ev="http://www.w3.org/2001/xml-events"
            xmlns:xs="http://www.w3.org/2001/XMLSchema">

    <xhtml:head>
        <xhtml:title>Test Base Paths</xhtml:title>
        <xforms:model id="mymodel">
            <xforms:instance id="instance1" xmlns="">
                <instance1>
                    <first-name/>
                </instance1>
            </xforms:instance>
            <xforms:instance id="instance2" xmlns="">
                <instance2>
                    <last-name/>
                </instance2>
            </xforms:instance>

            <xforms:bind nodeset="instance('instance1')">
                <xforms:bind nodeset="//*" readonly="true()"/>
            </xforms:bind>

        </xforms:model>

        <xhtml:link type="text/css" rel="stylesheet" href="/ops/yui/logger/assets/logger.css"/>
        <xhtml:script type="text/javascript" src="/ops/yui/logger/logger.js"/>
        <xhtml:script type="text/javascript" src="/ops/yui/yuitest/yuitest.js"/>
        <xhtml:script type="text/javascript">
            <![CDATA[
                YAHOO.tool.TestRunner.add(new YAHOO.tool.TestCase({

                    name: "Test xforms.js algorithm to set base paths",

                    setUp : function () {
                        this.resourcesBaseURL = ORBEON.xforms.Globals.resourcesBaseURL;
                        this.xformsServerURL = ORBEON.xforms.Globals.xformsServerURL;

                        this.dummyScript1 = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(this.dummyScript1, "src", "/orbeon/foobar");

                        this.dummyScript2 = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(this.dummyScript2, "src", "/other/file.js");
                    },

                    tearDown : function () {
                        ORBEON.xforms.Globals.resourcesBaseURL = this.resourcesBaseURL;
                        ORBEON.xforms.Globals.xformsServerURL = this.xformsServerURL;
                    },

                    // Tests with a non-empty context
                    testBasePath1: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/orbeon/ops/javascript/xforms-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, false);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/orbeon");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/orbeon/xforms-server");
                    },

                    testBasePath2: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/orbeon/xforms-server/xforms-foobar-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, false);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/orbeon");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/orbeon/xforms-server");
                    },

                    testBasePath3: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/orbeon/3.1415/ops/javascript/xforms-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, true);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/orbeon/3.1415");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/orbeon/xforms-server");
                    },

                    testBasePath4: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/orbeon/xforms-server/3.1415/xforms-foobar-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, true);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/orbeon/3.1415");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/orbeon/xforms-server");
                    },
                    // Tests with an empty context
                    testBasePath5: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/ops/javascript/xforms-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, false);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/xforms-server");
                    },

                    testBasePath6: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/xforms-server/xforms-foobar-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, false);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/xforms-server");
                    },

                    testBasePath7: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/3.1415/ops/javascript/xforms-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, true);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/3.1415");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/xforms-server");
                    },

                    testBasePath8: function() {

                        var scriptToMatch = document.createElement("script");
                        ORBEON.util.Dom.setAttribute(scriptToMatch, "src", "/xforms-server/3.1415/xforms-foobar-min.js");

                        var scripts = [this.dummyScript1, scriptToMatch, this.dummyScript2];

                        ORBEON.xforms.Init._setBasePaths(scripts, true);

                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.resourcesBaseURL, "/3.1415");
                        YAHOO.util.Assert.areEqual(ORBEON.xforms.Globals.xformsServerURL, "/xforms-server");
                    }
                }));
                ORBEON.xforms.Events.orbeonLoadedEvent.subscribe(function() {
                    if (parent && parent.TestManager) {
                        parent.TestManager.load();
                    } else {
                        new YAHOO.tool.TestLogger();
                        YAHOO.tool.TestRunner.run();
                    }
                });
            ]]>
        </xhtml:script>

    </xhtml:head>
    <xhtml:body>
        <xhtml:p>See log window for test results.</xhtml:p>
    </xhtml:body>
</xhtml:html>
{'fraction_non_alphanumeric': 0.12235265642018638, 'fraction_numerical': 0.011497034975190609, 'mean_word_length': 1.6291759465478841, 'pattern_counts': {'":': 0, '<': 65, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 8, 'xml': 26}, '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': '4939953', 'n_tokens_mistral': 4908, 'n_tokens_neox': 4486, 'n_words': 521}