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 syntax0.7.4-extended
parent
3fdeb559f0
commit
1ee6822e39
|
@ -405,7 +405,7 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
|||
// TestHelpers.EnableLogging();
|
||||
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun", "Times");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
|
@ -414,9 +414,78 @@ namespace OpenSim.Region.OptionalModules.Scripting.JsonStore.Tests
|
|||
Assert.That(value, Is.EqualTo("Times"));
|
||||
}
|
||||
|
||||
// Commented out as this currently unexpectedly fails.
|
||||
// Test setting a key containing periods.
|
||||
// {
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
//
|
||||
// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun.Circus}", "Times");
|
||||
// Assert.That(result, Is.EqualTo(1));
|
||||
//
|
||||
// string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun.Circus}");
|
||||
// Assert.That(value, Is.EqualTo("Times"));
|
||||
// }
|
||||
|
||||
// Test setting a key containing empty brackets
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[]Circus}", "Times");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
|
||||
string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun[]Circus}");
|
||||
Assert.That(value, Is.EqualTo("Times"));
|
||||
}
|
||||
|
||||
// Commented out as this currently unexpectedly fails.
|
||||
// // Test setting a key containing brackets with an integer
|
||||
// {
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
//
|
||||
// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun[0]Circus}", "Times");
|
||||
// Assert.That(result, Is.EqualTo(1));
|
||||
//
|
||||
// string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun[]Circus}");
|
||||
// Assert.That(value, Is.EqualTo("Times"));
|
||||
// }
|
||||
|
||||
// Commented out as this currently unexpectedly fails.
|
||||
// // Test setting a key containing unbalanced }
|
||||
// {
|
||||
// UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
//
|
||||
// int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun}Circus}", "Times");
|
||||
// Assert.That(result, Is.EqualTo(1));
|
||||
//
|
||||
// string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun}Circus}");
|
||||
// Assert.That(value, Is.EqualTo("Times"));
|
||||
// }
|
||||
|
||||
// Test setting a key containing unbalanced {
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun{Circus}", "Times");
|
||||
Assert.That(result, Is.EqualTo(1));
|
||||
|
||||
string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun{Circus}");
|
||||
Assert.That(value, Is.EqualTo("Times"));
|
||||
}
|
||||
|
||||
// Test setting a key containing balanced {}. This should fail.
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "{Fun{Filled}Circus}", "Times");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
|
||||
string value = (string)InvokeOp("JsonGetValue", storeId, "{Fun{Filled}Circus}");
|
||||
Assert.That(value, Is.EqualTo(""));
|
||||
}
|
||||
|
||||
// Test setting to location that does not exist. This should fail.
|
||||
{
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{ }");
|
||||
UUID storeId = (UUID)InvokeOp("JsonCreateStore", "{}");
|
||||
|
||||
int result = (int)InvokeOp("JsonSetValue", storeId, "Fun.Circus", "Times");
|
||||
Assert.That(result, Is.EqualTo(0));
|
||||
|
|
Loading…
Reference in New Issue