Skip to content

Commit

Permalink
pills: rm fileScanner
Browse files Browse the repository at this point in the history
  • Loading branch information
dvrkps committed May 12, 2020
1 parent 23791a5 commit c9b36df
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 21 deletions.
11 changes: 0 additions & 11 deletions pills/ui.go
Expand Up @@ -7,7 +7,6 @@ import (
"flag"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"os/exec"
Expand Down Expand Up @@ -94,16 +93,6 @@ func filePath(user string) (string, error) {
return p, nil
}

// fileScanner converts file content to scanner.
func fileScanner(path string) (*bufio.Scanner, error) {
c, err := ioutil.ReadFile(path)
if err != nil {
return nil, err
}

return bufio.NewScanner(bytes.NewReader(c)), nil
}

// midnight returns date with zeroed time.
func midnight(t time.Time) time.Time {
return time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, time.UTC)
Expand Down
10 changes: 0 additions & 10 deletions pills/ui_test.go
Expand Up @@ -23,16 +23,6 @@ func fakeFileContent() io.Reader {
return bytes.NewReader(c)
}

func TestFileScanner(t *testing.T) {
if _, err := fileScanner("pills.txt"); err != nil {
t.Errorf("fileScanner(\"pills.txt\") = _, %v; want <nil>", err)
}

if _, err := fileScanner("invalidpath"); err == nil {
t.Error("fileScanner(\"invalidpath\") = _, <nil>; want error")
}
}

func TestMidnight(t *testing.T) {
in := time.Date(2015, 8, 11, 1, 2, 3, 4, time.UTC)
want := time.Date(2015, 8, 11, 0, 0, 0, 0, time.UTC)
Expand Down

0 comments on commit c9b36df

Please sign in to comment.