Add regression TestGetArrayLength()

0.7.4-extended
Justin Clark-Casey (justincc) 2013-02-14 21:34:57 +00:00
parent c992037d50
commit 6e612937c7
1 changed files with 33 additions and 0 deletions

View File

@ -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()
{