mirror of
https://github.com/vrm-c/UniVRM.git
synced 2026-09-09 12:29:23 -05:00
Merge pull request #130 from dwango/fix_formatter_clear
Fixed IFormatter.Clear that JsonFormatter.Clear dose not called.
This commit is contained in:
@@ -43,5 +43,16 @@ namespace UniJSON
|
||||
Assert.True(json.GetStoreBytes().ToEnumerable().SequenceEqual(bytes));
|
||||
}
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ReUseFormatter()
|
||||
{
|
||||
IFormatter f = new JsonFormatter();
|
||||
f.Value(1);
|
||||
|
||||
f.Clear();
|
||||
// fail
|
||||
f.Value(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,11 +9,6 @@ namespace UniJSON
|
||||
{
|
||||
public static partial class FormatterExtensions
|
||||
{
|
||||
public static void Clear(this IFormatter f)
|
||||
{
|
||||
f.GetStore().Clear();
|
||||
}
|
||||
|
||||
public static ArraySegment<Byte> GetStoreBytes(this IFormatter f)
|
||||
{
|
||||
return f.GetStore().Bytes;
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace UniJSON
|
||||
public interface IFormatter
|
||||
{
|
||||
IStore GetStore();
|
||||
void Clear();
|
||||
|
||||
void BeginList(int n);
|
||||
void EndList();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
|
||||
namespace UniJSON
|
||||
@@ -16,6 +15,11 @@ namespace UniJSON
|
||||
{
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
m_store.Clear();
|
||||
}
|
||||
|
||||
#if false
|
||||
public bool MsgPack_Ext(IList list)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user