Skip to content

Commit

Permalink
After review improvements.
Browse files Browse the repository at this point in the history
- removed test folder we should find a better solution for testing `ReadFolder` method
- updated readme to reflect signature changes
  • Loading branch information
jaroslaw-bochniak committed Mar 21, 2018
1 parent 49f7650 commit 3979068
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 21 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ var music gotree.GTStructure
music.Name = "5 Minutes Alone"

//Add Music to the Album
album.Items = append(album.Items, music)
album.Items = append(album.Items, &music)

//Add Album to the Artist
artist.Items = append(artist.Items, album)
artist.Items = append(artist.Items, &album)

gotree.PrintTree(artist)
gotree.PrintTree(&artist)
```

### Read folder and print tree
Expand Down
18 changes: 0 additions & 18 deletions gotree_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,6 @@ import (
"testing"
)

// TestFolderTree should test if reading a folder returns rendered structure as expected
func TestFolderTree(t *testing.T) {
tree := ReadFolder("test-resources")
actual := StringTree(tree)
expected := "test-resources\n" +
"├── dir1\n" +
"│ ├── dir3\n" +
"│ │ └── file2.txt\n" +
"│ └── file1.txt\n" +
"├── dir2\n" +
"│ └── file3.txt\n" +
"└── file4.txt\n"

if actual != expected {
t.Fatalf("Actual tree::\n[%s]\nis not the same as expected:\n[%s]", actual, expected)
}
}

// TestUpdatingItemsStructure should test whenever item updates in the tree structure are
// reflected correctly in the rendered structure
func TestUpdatingItemsStructure(t *testing.T) {
Expand Down
Empty file removed test-resources/dir1/dir3/file2.txt
Empty file.
Empty file removed test-resources/dir1/file1.txt
Empty file.
Empty file removed test-resources/dir2/file3.txt
Empty file.
Empty file removed test-resources/file4.txt
Empty file.

0 comments on commit 3979068

Please sign in to comment.