From 6924bd21f48a4c2540ebd8316e966367157e97c7 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 11 Feb 2013 23:10:07 +0000 Subject: Add regression TestJsonTestPathJson() --- .../JsonStore/Tests/JsonStoreScriptModuleTests.cs | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'OpenSim/Region/OptionalModules') diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs index a2d065c..de42e74 100644 --- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs +++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs @@ -263,6 +263,38 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests } [Test] + public void TestJsonTestPathJson() + { + TestHelpers.InMethod(); +// TestHelpers.EnableLogging(); + + UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ 'Hello' : { 'World' : 'One' } }"); + + { + int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello.World"); + Assert.That(result, Is.EqualTo(1)); + } + + // Test for path which does not resolve to a value. + { + int result = (int)InvokeOp("JsonTestPathJson", storeId, "Hello"); + Assert.That(result, Is.EqualTo(1)); + } + + { + int result2 = (int)InvokeOp("JsonTestPathJson", storeId, "foo"); + Assert.That(result2, Is.EqualTo(0)); + } + + // Test with fake store + { + UUID fakeStoreId = TestHelpers.ParseTail(0x500); + int fakeStoreValueRemove = (int)InvokeOp("JsonTestPathJson", fakeStoreId, "Hello"); + Assert.That(fakeStoreValueRemove, Is.EqualTo(0)); + } + } + + [Test] public void TestJsonSetValue() { TestHelpers.InMethod(); -- cgit v1.1