diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index e5555d6..a457c7b 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -399,6 +399,39 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
399 | } | 399 | } |
400 | 400 | ||
401 | [Test] | 401 | [Test] |
402 | public void TestGetArrayLength() | ||
403 | { | ||
404 | TestHelpers.InMethod(); | ||
405 | // TestHelpers.EnableLogging(); | ||
406 | |||
407 | UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : [ 'one', 2 ] } }"); | ||
408 | |||
409 | { | ||
410 | int result = (int)InvokeOp("JsonGetArrayLength", storeId, "Hello.World"); | ||
411 | Assert.That(result, Is.EqualTo(2)); | ||
412 | } | ||
413 | |||
414 | // Test path which is not an array | ||
415 | { | ||
416 | int result = (int)InvokeOp("JsonGetArrayLength", storeId, "Hello"); | ||
417 | Assert.That(result, Is.EqualTo(-1)); | ||
418 | } | ||
419 | |||
420 | // Test fake path | ||
421 | { | ||
422 | int result = (int)InvokeOp("JsonGetArrayLength", storeId, "foo"); | ||
423 | Assert.That(result, Is.EqualTo(-1)); | ||
424 | } | ||
425 | |||
426 | // Test fake store | ||
427 | { | ||
428 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | ||
429 | int result = (int)InvokeOp("JsonGetArrayLength", fakeStoreId, "Hello.World"); | ||
430 | Assert.That(result, Is.EqualTo(-1)); | ||
431 | } | ||
432 | } | ||
433 | |||
434 | [Test] | ||
402 | public void TestJsonGetPathType() | 435 | public void TestJsonGetPathType() |
403 | { | 436 | { |
404 | TestHelpers.InMethod(); | 437 | TestHelpers.InMethod(); |