1- package simpleyaml
1+ package simpleyaml_test
22
33import (
44 "testing"
5+ "github.com/smallfish/simpleyaml"
6+ "github.com/smallfish/simpleyaml/helper/util"
57)
68
79var data = []byte (`
2325` )
2426
2527func TestBool (t * testing.T ) {
26- y , err := NewYaml (data )
28+ y , err := simpleyaml . NewYaml (data )
2729 if err != nil {
2830 t .Fatal ("init yaml failed" )
2931 }
@@ -38,7 +40,7 @@ func TestBool(t *testing.T) {
3840}
3941
4042func TestString (t * testing.T ) {
41- y , err := NewYaml (data )
43+ y , err := simpleyaml . NewYaml (data )
4244 if err != nil {
4345 t .Fatal ("init yaml failed" )
4446 }
@@ -53,7 +55,7 @@ func TestString(t *testing.T) {
5355}
5456
5557func TestStringFromIntKey (t * testing.T ) {
56- y , err := NewYaml (data )
58+ y , err := simpleyaml . NewYaml (data )
5759 if err != nil {
5860 t .Fatal ("init yaml failed" )
5961 }
@@ -69,7 +71,7 @@ func TestStringFromIntKey(t *testing.T) {
6971}
7072
7173func TestFloat (t * testing.T ) {
72- y , err := NewYaml (data )
74+ y , err := simpleyaml . NewYaml (data )
7375 if err != nil {
7476 t .Fatal ("init yaml failed" )
7577 }
@@ -85,7 +87,7 @@ func TestFloat(t *testing.T) {
8587}
8688
8789func TestInt (t * testing.T ) {
88- y , err := NewYaml (data )
90+ y , err := simpleyaml . NewYaml (data )
8991 if err != nil {
9092 t .Fatal ("init yaml failed" )
9193 }
@@ -100,7 +102,7 @@ func TestInt(t *testing.T) {
100102}
101103
102104func TestGetIndex (t * testing.T ) {
103- y , err := NewYaml (data )
105+ y , err := simpleyaml . NewYaml (data )
104106 if err != nil {
105107 t .Fatal ("init yaml failed" )
106108 }
@@ -112,7 +114,7 @@ func TestGetIndex(t *testing.T) {
112114}
113115
114116func TestString2 (t * testing.T ) {
115- y , err := NewYaml (data )
117+ y , err := simpleyaml . NewYaml (data )
116118 if err != nil {
117119 t .Fatal ("init yaml failed" )
118120 }
@@ -127,7 +129,7 @@ func TestString2(t *testing.T) {
127129}
128130
129131func TestGetPath (t * testing.T ) {
130- y , err := NewYaml (data )
132+ y , err := simpleyaml . NewYaml (data )
131133 if err != nil {
132134 t .Fatal ("init yaml failed" )
133135 }
@@ -141,8 +143,25 @@ func TestGetPath(t *testing.T) {
141143 }
142144}
143145
146+ func TestGetAllPaths (t * testing.T ) {
147+ y , err := simpleyaml .NewYaml (data )
148+ if err != nil {
149+ t .Fatal ("init yaml failed" )
150+ }
151+
152+ v , err := util .GetAllPaths (y )
153+ if err != nil {
154+ t .Fatal ("Getting all paths failed" )
155+ }
156+
157+ t .Log (v )
158+ if len (v ) != 10 {
159+ t .Fatal ("Number of paths do not match number or real paths." )
160+ }
161+ }
162+
144163func TestArray (t * testing.T ) {
145- y , err := NewYaml (data )
164+ y , err := simpleyaml . NewYaml (data )
146165 if err != nil {
147166 t .Fatal ("init yaml failed" )
148167 }
@@ -157,7 +176,7 @@ func TestArray(t *testing.T) {
157176}
158177
159178func TestMap (t * testing.T ) {
160- y , err := NewYaml (data )
179+ y , err := simpleyaml . NewYaml (data )
161180 if err != nil {
162181 t .Fatal ("init yaml failed" )
163182 }
@@ -175,7 +194,7 @@ func TestMap(t *testing.T) {
175194}
176195
177196func TestIsFound (t * testing.T ) {
178- y , err := NewYaml (data )
197+ y , err := simpleyaml . NewYaml (data )
179198 if err != nil {
180199 t .Fatal ("init yaml failed" )
181200 }
0 commit comments