aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2013-02-13 01:25:30 +0000
committerJustin Clark-Casey (justincc)2013-02-13 01:25:30 +0000
commitb1a165a39ad5aef2b55e367aa7ff984374016ba7 (patch)
treeab2a43b6e7a887abed9f466f2c46d248036f1df9 /OpenSim/Region/OptionalModules/Scripting
parentAdd test for array as root element in TestJsonCreateStore() (diff)
downloadopensim-SC_OLD-b1a165a39ad5aef2b55e367aa7ff984374016ba7.zip
opensim-SC_OLD-b1a165a39ad5aef2b55e367aa7ff984374016ba7.tar.gz
opensim-SC_OLD-b1a165a39ad5aef2b55e367aa7ff984374016ba7.tar.bz2
opensim-SC_OLD-b1a165a39ad5aef2b55e367aa7ff984374016ba7.tar.xz
Extend JsonTestSetValue() with tests for escaping brackets, periods and unbalanced braces from paths
The sub-tests that are commented out are currently those which fail unexpectedly based on my understanding of the path syntax
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs73
1 files changed, 71 insertions, 2 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
index 9721b8d..71983b3 100644
--- a/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/JsonStore/Tests/JsonStoreScriptModuleTests.cs
@@ -405,7 +405,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
405// TestHelpers.EnableLogging(); 405// TestHelpers.EnableLogging();
406 406
407 { 407 {
408 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 408 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
409 409
410 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times"); 410 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times");
411 Assert.That(result, Is.EqualTo(1)); 411 Assert.That(result, Is.EqualTo(1));
@@ -414,9 +414,78 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
414 Assert.That(value, Is.EqualTo("Times")); 414 Assert.That(value, Is.EqualTo("Times"));
415 } 415 }
416 416
417 // Commented out as this currently unexpectedly fails.
418 // Test setting a key containing periods.
419// {
420// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
421//
422// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun.Circus}", "Times");
423// Assert.That(result, Is.EqualTo(1));
424//
425// string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun.Circus}");
426// Assert.That(value, Is.EqualTo("Times"));
427// }
428
429 // Test setting a key containing empty brackets
430 {
431 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
432
433 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[]Circus}", "Times");
434 Assert.That(result, Is.EqualTo(1));
435
436 string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun[]Circus}");
437 Assert.That(value, Is.EqualTo("Times"));
438 }
439
440 // Commented out as this currently unexpectedly fails.
441// // Test setting a key containing brackets with an integer
442// {
443// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
444//
445// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[0]Circus}", "Times");
446// Assert.That(result, Is.EqualTo(1));
447//
448// string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun[]Circus}");
449// Assert.That(value, Is.EqualTo("Times"));
450// }
451
452 // Commented out as this currently unexpectedly fails.
453// // Test setting a key containing unbalanced }
454// {
455// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
456//
457// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun}Circus}", "Times");
458// Assert.That(result, Is.EqualTo(1));
459//
460// string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun}Circus}");
461// Assert.That(value, Is.EqualTo("Times"));
462// }
463
464 // Test setting a key containing unbalanced {
465 {
466 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
467
468 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun{Circus}", "Times");
469 Assert.That(result, Is.EqualTo(1));
470
471 string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun{Circus}");
472 Assert.That(value, Is.EqualTo("Times"));
473 }
474
475 // Test setting a key containing balanced {}. This should fail.
476 {
477 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
478
479 int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun{Filled}Circus}", "Times");
480 Assert.That(result, Is.EqualTo(0));
481
482 string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun{Filled}Circus}");
483 Assert.That(value, Is.EqualTo(""));
484 }
485
417 // Test setting to location that does not exist. This should fail. 486 // Test setting to location that does not exist. This should fail.
418 { 487 {
419 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }"); 488 UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
420 489
421 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun.Circus", "Times"); 490 int result = (int)InvokeOp("JsonSetValue", storeId, "Fun.Circus", "Times");
422 Assert.That(result, Is.EqualTo(0)); 491 Assert.That(result, Is.EqualTo(0));