Skip to content

Commit

Permalink
Issue #1: Fixed that Keys() returns an empty key.
Browse files Browse the repository at this point in the history
  • Loading branch information
magiconair committed Nov 13, 2014
1 parent 9901c56 commit 10c5930
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ $ go get -u github.com/magiconair/properties
History
-------

v1.4.1, 13 Nov 2014
-------------------
* (Issue #1) Fixed bug in Keys() method which returned an empty string

v1.4.0, 23 Sep 2014
-------------------
* Added Keys() to get the keys
Expand Down
2 changes: 1 addition & 1 deletion properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ func (p *Properties) Len() int {

// Keys returns all keys.
func (p *Properties) Keys() []string {
keys := make([]string, len(p.m))
keys := make([]string, 0, len(p.m))
for k, _ := range p.m {
keys = append(keys, k)
}
Expand Down
1 change: 1 addition & 0 deletions properties_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ func (l *TestSuite) TestKeys(c *C) {
p, err := parse(test.input)
c.Assert(err, IsNil)
c.Assert(p.Len(), Equals, len(test.keys))
c.Assert(len(p.Keys()), Equals, len(test.keys))
for _, key := range test.keys {
_, ok := p.Get(key)
c.Assert(ok, Equals, true)
Expand Down

0 comments on commit 10c5930

Please sign in to comment.