Jim, thanks for catching that case! It's checked in now. See //depot/lps-dev/test/lfc/data/lzunit-lzparsedpath.lzx for an lzunit test that shows both issues fixed.

Regards,
Max Carlson
OpenLaszlo.org

Jim Grandy wrote:
This looks like a great candidate for a unit test...

...so I wrote one, and found a bug: you don't handle escaped quotes correctly.

Approved if you fix this bug and also include a unit test against LzParsedPath.as.

<canvas debug="true">
    <include href="lzunit"/>

    <script><![CDATA[
        function compareArrays(a1, a2)
        {
            Debug.format("%w, %w\n", a1, a2);
            // assumes arrays are shallow
            if (a1.length != a2.length)
                return false;
            for (var i = 0; i < a1.length; i++)
            {
                if (a1[i] != a2[i])
                    return false;
            }
            return true;
        }

        function splitSlashes0(rest)
        {
            return rest.split( "/" );
        }

        function splitSlashes1(rest)
        {
            var nodes = [];
            var currnode = '';
            var instring = false;
            for (var i = 0; i < rest.length; i++) {
                var c = rest.charAt(i);
                if (instring == false && c == "/") {
// only count slashes as new nodes if we're not inside a string
                    // literal

                    nodes.push(currnode);
                    currnode = '';
                    continue;
                } else if (c == "'") {
                    instring = instring ? false : true;
                }
                currnode += c;
            }
            nodes.push(currnode);
            return nodes;
        }
    ]]></script>

    <TestSuite>

        <TestCase>

            <method name="exerciseOne" args="f">
                assertTrue(compareArrays(["one"], f("one")));
                assertTrue(compareArrays(["one", "two"], f("one/two")));
assertTrue(compareArrays(["one", "'two/three'"], f("one/'two/three'"))); assertTrue(compareArrays(["one", "'two/three\'four'"], f("one/'two/three\'four'"))); assertTrue(compareArrays(["one", "'two/three\'four/five'"], f("one/'two/three\'four/five'")));
            </method>

            <method name="testBasic0">
                exerciseOne(splitSlashes0);
            </method>
            <method name="testBasic1">
                exerciseOne(splitSlashes1);
            </method>
        </TestCase>

    </TestSuite>

</canvas>

On Jan 23, 2006, at 11:07 AM, Max Carlson wrote:

Change 37505 by [EMAIL PROTECTED] on 2006/01/23 11:04:12 *pending*

Summary: Fix for lpp-737: XPath won't match attribute values with / in t
hem

        New Features:

        Bugs Fixed: lpp-737

        Technical Reviewer:  (pending)
        QA Reviewer:  (pending)
        Doc Reviewer:  (pending)

        Documentation:

        Release Notes:

        Details:

        Tests:

Affected files ...

... //depot/lps-dev/WEB-INF/lps/lfc/data/LzParsedPath.as#5 edit
<changeset-37505.zip>



_______________________________________________
Laszlo-dev mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-dev

Reply via email to