diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index f25f290..e5555d6 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs | |||
@@ -399,6 +399,53 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests | |||
399 | } | 399 | } |
400 | 400 | ||
401 | [Test] | 401 | [Test] |
402 | public void TestJsonGetPathType() | ||
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("JsonGetPathType", storeId, "."); | ||
411 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_OBJECT)); | ||
412 | } | ||
413 | |||
414 | { | ||
415 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello"); | ||
416 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_OBJECT)); | ||
417 | } | ||
418 | |||
419 | { | ||
420 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World"); | ||
421 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_ARRAY)); | ||
422 | } | ||
423 | |||
424 | { | ||
425 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World[0]"); | ||
426 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); | ||
427 | } | ||
428 | |||
429 | { | ||
430 | int result = (int)InvokeOp("JsonGetPathType", storeId, "Hello.World[1]"); | ||
431 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_VALUE)); | ||
432 | } | ||
433 | |||
434 | // Test for non-existant path | ||
435 | { | ||
436 | int result = (int)InvokeOp("JsonGetPathType", storeId, "foo"); | ||
437 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | ||
438 | } | ||
439 | |||
440 | // Test for non-existant store | ||
441 | { | ||
442 | UUID fakeStoreId = TestHelpers.ParseTail(0x500); | ||
443 | int result = (int)InvokeOp("JsonGetPathType", fakeStoreId, "."); | ||
444 | Assert.That(result, Is.EqualTo(JsonStoreScriptModule.JSON_TYPE_UNDEF)); | ||
445 | } | ||
446 | } | ||
447 | |||
448 | [Test] | ||
402 | public void TestJsonSetValue() | 449 | public void TestJsonSetValue() |
403 | { | 450 | { |
404 | TestHelpers.InMethod(); | 451 | TestHelpers.InMethod(); |