Add regression TestGetArrayLength()
parent
c992037d50
commit
6e612937c7
|
@ -398,6 +398,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
|||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestGetArrayLength()
|
||||
{
|
||||
TestHelpers.InMethod();
|
||||
// TestHelpers.EnableLogging();
|
||||
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }");
|
||||
|
||||
{
|
||||
int result = (int)InvokeOp("JsonGetArrayLength", storeId, "Hello.World");
|
||||
Assert.That(result, Is.EqualTo(2));
|
||||
}
|
||||
|
||||
// Test path which is not an array
|
||||
{
|
||||
int result = (int)InvokeOp("JsonGetArrayLength", storeId, "Hello");
|
||||
Assert.That(result, Is.EqualTo(-1));
|
||||
}
|
||||
|
||||
// Test fake path
|
||||
{
|
||||
int result = (int)InvokeOp("JsonGetArrayLength", storeId, "foo");
|
||||
Assert.That(result, Is.EqualTo(-1));
|
||||
}
|
||||
|
||||
// Test fake store
|
||||
{
|
||||
UUID fakeStoreId = TestHelpers.ParseTail(0x500);
|
||||
int result = (int)InvokeOp("JsonGetArrayLength", fakeStoreId, "Hello.World");
|
||||
Assert.That(result, Is.EqualTo(-1));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestJsonGetPathType()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue