aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-02-14 21:31:34 +0000
committerJustin Clark-Casey (justincc)2013-02-14 21:31:34 +0000
commit6fe771f27e08f516a93ba7c04010a3157841b061 (patch)
tree49465dd7083aae10ec8ac9e8cf722ba2c0e278e2 /OpenSim/Region/OptionalModules/Scripting
parentminor: remove some mono compiler warnings (diff)
downloadopensim-SC_OLD-6fe771f27e08f516a93ba7c04010a3157841b061.zip
opensim-SC_OLD-6fe771f27e08f516a93ba7c04010a3157841b061.tar.gz
opensim-SC_OLD-6fe771f27e08f516a93ba7c04010a3157841b061.tar.bz2
opensim-SC_OLD-6fe771f27e08f516a93ba7c04010a3157841b061.tar.xz
Add regression TestJsonGetPathType()
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs47
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();