Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0006542opensim[REGION] Script Functionspublic2013-02-12 23:182013-02-20 08:35
Reportercmickeyb 
Assigned Tojustincc 
PrioritynormalSeverityminorReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Versionmaster (dev code) 
Target Versionmaster (dev code)Fixed in Version 
Summary0006542: jsonstore path tests need to be fixed
Descriptionthe set value tests are failing in part because the structure up to the paths does not exist. a better way to test is to use JsonList2Path() which expands the list. Internally you can call the CanonicalPathExpression() function to parse the paths.

All of the path tests in the script should generate valid paths except those marked.
Steps To Reproduce// -----------------------------------------------------------------
// -----------------------------------------------------------------
CanonicalPath(string path)
{
    llOwnerSay(osFormatString("Path {0} expands to {1}",
       [path,JsonList2Path([path])]));
}


// -----------------------------------------------------------------
// -----------------------------------------------------------------
ExecuteCanonicalPathTest()
{
    CanonicalPath("testa");
    CanonicalPath("testa.a");
    CanonicalPath("testa.a.b.c.d");
    CanonicalPath("testa.a0"); // FAILS, **INVALID**
    CanonicalPath("test]b"); // FAILS, **INVALID**
    CanonicalPath("test[c"); // FAILS, **INVALID**
    CanonicalPath("test[]d"); // FAILS, **INVALID**
    CanonicalPath("test[0]d");
    CanonicalPath("{test}[0]d");
    CanonicalPath("d{test}[0]d");
    CanonicalPath("{test[e}");
    CanonicalPath("{test[]f}");
    CanonicalPath("{test[0]f}");
    CanonicalPath("test}g"); // FAILS, **INVALID**
    CanonicalPath("test{h"); // FAILS, **INVALID**
    CanonicalPath("{test}i");
    CanonicalPath("{test{j}");
    CanonicalPath("{test{k}l}");
    CanonicalPath("{test.m}");
    CanonicalPath("{test.m.n.o}");
    CanonicalPath("{test.m0}");

    CanonicalPath("{.abc.ge}");
    CanonicalPath("{a0.cd}");
    CanonicalPath("{a.b.c.d}");
    CanonicalPath("{a.b.c.}");
}

default
{
    state_entry()
    {
        llSay(0, "Script running");
        llListen(iChannel,"",llGetOwner(),"");
    }
    
    touch_start(integer i)
    {
        ExecuteCanonicalPathTest();
    }
}
TagsNo tags attached.
Git Revision or version number
Run Mode Grid (1 Region per Sim)
Physics EngineBasicPhysics
EnvironmentUnknown
Mono VersionNone
Viewer
Attached Files

- Relationships

-  Notes
(0023574)
justincc (administrator)
2013-02-13 17:19

Okay, I'll take a look at this. Hope to be around a bit earlier tomorrow, had to attend to other things today.
(0023583)
justincc (administrator)
2013-02-19 15:54

Okay, the script below demonstrates that a literally path with an embedded [0] section fails to set.

TestSetThenGet(string path)
{
    key storeID = JsonCreateStore("{}");
    
    JsonSetValue(storeID, path, "elephant");
    string v = JsonGetValue(storeID, path);
            
    llOwnerSay("Value was '" + v + "'");
    
    JsonDestroyStore(storeID);
}

default
{
    touch_start(integer n)
    {
        TestSetThenGet("{Fun[0]Circus}");
    }
}

The result is a blank (unset) value and the simulator console shows

[JsonStore]: wrong type for key {Fun[0]Circus}, expecting Array, got Map
(0023586)
cmickeyb (administrator)
2013-02-20 08:35

The example works correctly now. The tests are fixed. And the old testpath functiosn are removed. Closing this.

- Issue History
Date Modified Username Field Change
2013-02-12 23:18 cmickeyb New Issue
2013-02-12 23:18 cmickeyb Status new => assigned
2013-02-12 23:18 cmickeyb Assigned To => justincc
2013-02-13 17:19 justincc Note Added: 0023574
2013-02-19 15:54 justincc Note Added: 0023583
2013-02-20 08:35 cmickeyb Note Added: 0023586
2013-02-20 08:35 cmickeyb Status assigned => resolved
2013-02-20 08:35 cmickeyb Resolution open => fixed
2013-02-20 08:35 cmickeyb Status resolved => closed


Copyright © 2000 - 2012 MantisBT Group
Powered by Mantis Bugtracker