From 8fcfd8224165908284b729935a5bf61d07545958 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Feb 2013 22:44:25 +0000 Subject: Extend TestJsonTestPath() for non-terminating section of path (i.e. one that does not point to a value/leaf) --- .../JsonStore/Tests/JsonStoreScriptModuleTests.cs | 28 +++++++++++++++------- 1 file changed, 20 insertions(+), 8 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index 2af3afc..98d8ff6 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs @@ -224,18 +224,30 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests TestHelpers.InMethod(); // TestHelpers.EnableLogging(); - UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : 'World' }"); + UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }"); - int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); - Assert.That(result, Is.EqualTo(1)); + { + int result = (int)InvokeOp("JsonTestPath", storeId, "Hello.World"); + Assert.That(result, Is.EqualTo(1)); + } + + // Test for path which does not resolve to a value. + { + int result = (int)InvokeOp("JsonTestPath", storeId, "Hello"); + Assert.That(result, Is.EqualTo(0)); + } - int result2 = (int)InvokeOp("JsonTestPath", storeId, "foo"); - Assert.That(result2, Is.EqualTo(0)); + { + int result2 = (int)InvokeOp("JsonTestPath", storeId, "foo"); + Assert.That(result2, Is.EqualTo(0)); + } // Test with fake store - UUID fakeStoreId = TestHelpers.ParseTail(0x500); - int fakeStoreValueRemove = (int)InvokeOp("JsonTestPath", fakeStoreId, "Hello"); - Assert.That(fakeStoreValueRemove, Is.EqualTo(0)); + { + UUID fakeStoreId = TestHelpers.ParseTail(0x500); + int fakeStoreValueRemove = (int)InvokeOp("JsonTestPath", fakeStoreId, "Hello"); + Assert.That(fakeStoreValueRemove, Is.EqualTo(0)); + } } [Test] -- cgit v1.1