Skip to content

Commit

Permalink
goyaml is now yaml.
Browse files Browse the repository at this point in the history
  • Loading branch information
niemeyer committed Mar 5, 2014
1 parent 2628b30 commit ca3d523
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 372 deletions.
39 changes: 0 additions & 39 deletions Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion apic.go
@@ -1,4 +1,4 @@
package goyaml
package yaml

import (
"io"
Expand Down
2 changes: 1 addition & 1 deletion decode.go
@@ -1,4 +1,4 @@
package goyaml
package yaml

import (
"reflect"
Expand Down
22 changes: 11 additions & 11 deletions decode_test.go
@@ -1,8 +1,8 @@
package goyaml_test
package yaml_test

import (
. "launchpad.net/gocheck"
"launchpad.net/goyaml"
"gonuts.org/v1/yaml"
"math"
"reflect"
)
Expand Down Expand Up @@ -377,7 +377,7 @@ func (s *S) TestUnmarshal(c *C) {
pv := reflect.New(pt.Elem())
value = pv.Interface()
}
err := goyaml.Unmarshal([]byte(item.data), value)
err := yaml.Unmarshal([]byte(item.data), value)
c.Assert(err, IsNil, Commentf("Item #%d", i))
if t.Kind() == reflect.String {
c.Assert(*value.(*string), Equals, item.value, Commentf("Item #%d", i))
Expand All @@ -389,7 +389,7 @@ func (s *S) TestUnmarshal(c *C) {

func (s *S) TestUnmarshalNaN(c *C) {
value := map[string]interface{}{}
err := goyaml.Unmarshal([]byte("notanum: .NaN"), &value)
err := yaml.Unmarshal([]byte("notanum: .NaN"), &value)
c.Assert(err, IsNil)
c.Assert(math.IsNaN(value["notanum"].(float64)), Equals, true)
}
Expand All @@ -408,7 +408,7 @@ var unmarshalErrorTests = []struct {
func (s *S) TestUnmarshalErrors(c *C) {
for _, item := range unmarshalErrorTests {
var value interface{}
err := goyaml.Unmarshal([]byte(item.data), &value)
err := yaml.Unmarshal([]byte(item.data), &value)
c.Assert(err, ErrorMatches, item.error, Commentf("Partial unmarshal: %#v", value))
}
}
Expand Down Expand Up @@ -449,7 +449,7 @@ type typeWithSetterField struct {
func (s *S) TestUnmarshalWithSetter(c *C) {
for _, item := range setterTests {
obj := &typeWithSetterField{}
err := goyaml.Unmarshal([]byte(item.data), obj)
err := yaml.Unmarshal([]byte(item.data), obj)
c.Assert(err, IsNil)
c.Assert(obj.Field, NotNil,
Commentf("Pointer not initialized (%#v)", item.value))
Expand All @@ -460,7 +460,7 @@ func (s *S) TestUnmarshalWithSetter(c *C) {

func (s *S) TestUnmarshalWholeDocumentWithSetter(c *C) {
obj := &typeWithSetter{}
err := goyaml.Unmarshal([]byte(setterTests[0].data), obj)
err := yaml.Unmarshal([]byte(setterTests[0].data), obj)
c.Assert(err, IsNil)
c.Assert(obj.tag, Equals, setterTests[0].tag)
value, ok := obj.value.(map[interface{}]interface{})
Expand All @@ -478,7 +478,7 @@ func (s *S) TestUnmarshalWithFalseSetterIgnoresValue(c *C) {

m := map[string]*typeWithSetter{}
data := "{abc: 1, def: 2, ghi: 3, jkl: 4}"
err := goyaml.Unmarshal([]byte(data), m)
err := yaml.Unmarshal([]byte(data), m)
c.Assert(err, IsNil)
c.Assert(m["abc"], NotNil)
c.Assert(m["def"], IsNil)
Expand All @@ -502,7 +502,7 @@ func (s *S) TestUnmarshalWithFalseSetterIgnoresValue(c *C) {
// var err error
// for i := 0; i < c.N; i++ {
// var v map[string]interface{}
// err = goyaml.Unmarshal(data, &v)
// err = yaml.Unmarshal(data, &v)
// }
// if err != nil {
// panic(err)
Expand All @@ -511,9 +511,9 @@ func (s *S) TestUnmarshalWithFalseSetterIgnoresValue(c *C) {
//
//func (s *S) BenchmarkMarshal(c *C) {
// var v map[string]interface{}
// goyaml.Unmarshal(data, &v)
// yaml.Unmarshal(data, &v)
// c.ResetTimer()
// for i := 0; i < c.N; i++ {
// goyaml.Marshal(&v)
// yaml.Marshal(&v)
// }
//}
2 changes: 1 addition & 1 deletion emitterc.go
@@ -1,4 +1,4 @@
package goyaml
package yaml

import (
"bytes"
Expand Down
2 changes: 1 addition & 1 deletion encode.go
@@ -1,4 +1,4 @@
package goyaml
package yaml

import (
"reflect"
Expand Down
18 changes: 9 additions & 9 deletions encode_test.go
@@ -1,9 +1,9 @@
package goyaml_test
package yaml_test

import (
"fmt"
. "launchpad.net/gocheck"
"launchpad.net/goyaml"
"gonuts.org/v1/yaml"
"math"
"strconv"
"strings"
Expand Down Expand Up @@ -216,7 +216,7 @@ var marshalTests = []struct {

func (s *S) TestMarshal(c *C) {
for _, item := range marshalTests {
data, err := goyaml.Marshal(item.value)
data, err := yaml.Marshal(item.value)
c.Assert(err, IsNil)
c.Assert(string(data), Equals, item.data)
}
Expand All @@ -237,7 +237,7 @@ var marshalErrorTests = []struct {

func (s *S) TestMarshalErrors(c *C) {
for _, item := range marshalErrorTests {
_, err := goyaml.Marshal(item.value)
_, err := yaml.Marshal(item.value)
c.Assert(err, ErrorMatches, item.error)
}
}
Expand Down Expand Up @@ -269,12 +269,12 @@ func (s *S) TestMarshalTypeCache(c *C) {
var err error
func() {
type T struct{ A int }
data, err = goyaml.Marshal(&T{})
data, err = yaml.Marshal(&T{})
c.Assert(err, IsNil)
}()
func() {
type T struct{ B int }
data, err = goyaml.Marshal(&T{})
data, err = yaml.Marshal(&T{})
c.Assert(err, IsNil)
}()
c.Assert(string(data), Equals, "b: 0\n")
Expand All @@ -298,7 +298,7 @@ func (s *S) TestMashalWithGetter(c *C) {
obj := &typeWithGetterField{}
obj.Field.tag = item.tag
obj.Field.value = item.value
data, err := goyaml.Marshal(obj)
data, err := yaml.Marshal(obj)
c.Assert(err, IsNil)
c.Assert(string(data), Equals, string(item.data))
}
Expand All @@ -308,7 +308,7 @@ func (s *S) TestUnmarshalWholeDocumentWithGetter(c *C) {
obj := &typeWithGetter{}
obj.tag = ""
obj.value = map[string]string{"hello": "world!"}
data, err := goyaml.Marshal(obj)
data, err := yaml.Marshal(obj)
c.Assert(err, IsNil)
c.Assert(string(data), Equals, "hello: world!\n")
}
Expand Down Expand Up @@ -356,7 +356,7 @@ func (s *S) TestSortedOutput(c *C) {
for _, k := range order {
m[k] = 1
}
data, err := goyaml.Marshal(m)
data, err := yaml.Marshal(m)
c.Assert(err, IsNil)
out := "\n" + string(data)
last := 0
Expand Down

0 comments on commit ca3d523

Please sign in to comment.