Skip to content

Commit

Permalink
Added tests for wildcard extension in include paths
Browse files Browse the repository at this point in the history
  • Loading branch information
aThorp96 committed Jan 2, 2019
1 parent cdb2ea8 commit bd4a2b1
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 0 deletions.
21 changes: 21 additions & 0 deletions ledgerReader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,27 @@ func TestLedgerScannerSingleInclude(t *testing.T) {
}
}

func TestLedgerScannerWildcardInclude(t *testing.T) {
r, err := NewLedgerReader("testdata/ledgerReader_input_1_root")
if err != nil {
t.Fatal(err)
}

parsed, err := ioutil.ReadAll(r)
if err != nil {
t.Fatal(err)
}

expected, _ := ioutil.ReadFile(filepath.Join("testdata", "ledgerReader_expected_1"))
if err != nil {
t.Fatal(err)
}

if !bytes.Equal(parsed, expected) {
t.Fatalf("expected:\n%s\n\n got:\n%s", expected, parsed)
}
}

func TestMarkerSplit(t *testing.T) {
filename, lineNum := parseMarker(";__ledger_file*-*/somedir/somefile*-*45")
if filename != "/somedir/somefile" {
Expand Down
13 changes: 13 additions & 0 deletions testdata/ledgerReader_expected_wildcard
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
;__ledger_file*-*testdata/ledgerReader_input_root_wildcard*-*0
the
quick
;__ledger_file*-*testdata/ledgerReader_input_wildcard_1*-*0
brown
fox
jumps
;__ledger_file*-*testdata/ledgerReader_input_wildcard_2*-*0
over
the
;__ledger_file*-*testdata/ledgerReader_input_1_root*-*3
lazy
dog
3 changes: 3 additions & 0 deletions testdata/ledgerReader_input_wildcard_1
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jumps
over
the
3 changes: 3 additions & 0 deletions testdata/ledgerReader_input_wildcard_2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
jumps
over
the
4 changes: 4 additions & 0 deletions testdata/ledgerReader_input_wildcard_root
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
the
include ledgerReader_input_wildcard*
lazy
dog

0 comments on commit bd4a2b1

Please sign in to comment.