Update to 1.1.0 #5

Merged
Booklordofthedings merged 16 commits from dev into main 2024-09-26 17:32:20 +02:00
4 changed files with 63 additions and 0 deletions
Showing only changes of commit 4076974f6b - Show all commits

View file

@ -24,6 +24,17 @@ class Bofa
return pType.Deserialize(b);
}
///Only turns the contents of this object into a string and not itself
public void ToStringContents(String strBuffer)
{
if(this.Type == .Object)
for(var i in this.Value.Object)
i.value.ToString(strBuffer);
else if(this.Type == .Array)
for(var i in this.Value.Array)
i.ToString(strBuffer);
}
public override void ToString(String strBuffer)
{
int64 depth = 0;

View file

@ -51,7 +51,11 @@ class BofaParser
if (entry.Type == .Error)
{
if (entry.Data.Bofa != null)
{
entry.Data.Bofa.[Friend]_line = null;
delete entry.Data.Bofa;
}
pErrors.Add(line);
continue;
}

View file

@ -18,6 +18,9 @@ class AdditionalParsers
if(res case .Err)
return .Err;
if(idx == toReturn.Count)
return .Err;
toReturn[idx] = res.Value;
}
return .Ok(toReturn);
@ -36,6 +39,9 @@ class AdditionalParsers
if(res case .Err)
return .Err;
if(idx == toReturn.Count)
return .Err;
toReturn[idx] = res.Value;
}
return .Ok(toReturn);

View file

@ -0,0 +1,42 @@
namespace Bofa.Testing;
/*
Testing the new functionality that comes with 1.1.0
*/
using System;
using System.Collections;
class Update_1_1_0
{
[Test(Name="1.1.0 - New Types")]
public static void Test_Types()
{
String content = """
# Should work
rgba alpha FF FF FF FF
rgb nonAlpha 34 67 EF
hash id sha256-218989F4E69B157EA38EBFC3051FB7A0011FBD1B2E4303DCB48D46C10622DA0B
hash without 218989F4E69B157EA38EBFC3051FB7A0011FBD1B2E4303DCB48D46C10622DA0B
# Should error
hash id md5-218989F4E69B157EA38EBFC3051FB7A0011FBD1B2E4303DCB48D46C10622DA0B
rgba alpha ZZ ZZ ZZ ZZ
rgb nonAlpha DE AD BE EF
""";
Dictionary<StringView, Bofa> output = new .();
List<int64> errors = new .();
BofaParser.Parse(content, output, errors);
Test.Assert(output.Count == 4);
Test.Assert(errors.Count == 3);
DeleteDictionaryAndValues!(output);
delete errors;
}
[Test(Name="1.1.0 - Serializations")]
public static void Test_Serialize()
{
}
}