mirror of
https://github.com/emirpasic/gods.git
synced 2026-06-17 16:36:39 +03:00
Implements json.Marshaler and json.Unmarshaler interfaces
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
package arraystack
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
@@ -360,11 +361,16 @@ func TestStackSerialization(t *testing.T) {
|
||||
|
||||
assert()
|
||||
|
||||
json, err := stack.ToJSON()
|
||||
bytes, err := stack.ToJSON()
|
||||
assert()
|
||||
|
||||
err = stack.FromJSON(json)
|
||||
err = stack.FromJSON(bytes)
|
||||
assert()
|
||||
|
||||
bytes, err = json.Marshal([]interface{}{"a", "b", "c", stack})
|
||||
if err != nil {
|
||||
t.Errorf("Got error %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func benchmarkPush(b *testing.B, stack *Stack, size int) {
|
||||
|
||||
Reference in New Issue
Block a user