Update to 1.1.0 #5
4 changed files with 63 additions and 0 deletions
11
src/Bofa.bf
11
src/Bofa.bf
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
42
src/Testing/Update_1_1_0.bf
Normal file
42
src/Testing/Update_1_1_0.bf
Normal 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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue