Skip to content

Commit

Permalink
Merge pull request #517 from adamdecaf/revert-test-file-writes
Browse files Browse the repository at this point in the history
Revert "test: write example files to disk rather than stdout"
  • Loading branch information
adamdecaf authored Apr 15, 2019
2 parents 1c877b1 + e0b67ce commit 5f8dc7e
Show file tree
Hide file tree
Showing 45 changed files with 85 additions and 288 deletions.
2 changes: 1 addition & 1 deletion batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func TestBatch__UnmarshalJSON(t *testing.T) {
t.Error("file == nil")
}

if v := file.Header.FileCreationDate; v != time.Now().Format("060102") { // YYMMDD
if v := file.Header.FileCreationDate; v != "180614" {
t.Errorf("got FileCreationDate of %q", v)
}
if v := file.Header.FileCreationTime; v != "0000" {
Expand Down
6 changes: 3 additions & 3 deletions test/ach-ack-read/ack-read.ach
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
101 031300012 2313801041904120000A094101Federal Reserve Bank My Bank Name
5220Name on Account 231380104 ACKVndr Pay 190413 1231380100000001
101 031300012 2313801041810290000A094101Federal Reserve Bank My Bank Name
5220Name on Account 231380104 ACKVndr Pay 181030 1231380100000001
624031300012744-5678-99 0000000000031300010000001Best. #1 0231380100000001
624031300012744-5678-99 0000000000031300010000002Best. #1 0231380100000002
82200000020006260002000000000000000000000000231380104 231380100000001
9000001000001000000020006260002000000000000000000000000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
11 changes: 1 addition & 10 deletions test/ach-ack-write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"time"

"github.com/moov-io/ach"
Expand Down Expand Up @@ -70,15 +69,7 @@ func main() {
}

// write the file to std out. Anything io.Writer
fd, err := os.Create(filepath.Join("..", "ach-ack-read", "ack-read.ach"))
if err != nil {
log.Fatalf("Unexpected error creating output file: %s\n", err)
}
defer func() {
fd.Sync()
fd.Close()
}()
w := ach.NewWriter(fd)
w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
Expand Down
6 changes: 3 additions & 3 deletions test/ach-adv-read/adv-read.ach
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
101 231380104 1210428821904120000A094101Federal Reserve Bank My Bank Name
5280Company Name, In 121042882 ADVAccounting 190413 0121042880000001
101 231380104 1210428821811130000A094101Federal Reserve Bank My Bank Name
5280Company Name, In 121042882 ADVAccounting 181114 0121042880000001
681231380104744-5678-99 00000005000012104288211131 Name 0011000010500001
682231380104744-5678-99 00000025000012104288211139 Name 0011000010500002
828000000200462760200000000000000025000000000000000000050000Company Name, Inc 121042880000001
90000010000010000000200462760200000000000000025000000000000000000050000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
11 changes: 1 addition & 10 deletions test/ach-adv-write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"time"

"github.com/moov-io/ach"
Expand Down Expand Up @@ -82,15 +81,7 @@ func main() {
}

// write the file to std out. Anything io.Writer
fd, err := os.Create(filepath.Join("..", "ach-adv-read", "adv-read.ach"))
if err != nil {
log.Fatalf("Unexpected error creating output file: %s\n", err)
}
defer func() {
fd.Sync()
fd.Close()
}()
w := ach.NewWriter(fd)
w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
Expand Down
6 changes: 3 additions & 3 deletions test/ach-arc-read/arc-debit.ach
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
101 231380104 1210428821904120000A094101Federal Reserve Bank My Bank Name
5225Payee Name 121042882 ARCACH ARC 190413 1121042880000001
101 231380104 1210428821806070000A094101Federal Reserve Bank My Bank Name
5225Payee Name 121042882 ARCACH ARC 180608 1121042880000001
62723138010412345678 0000250000123879654 ABC Company 0121042880000001
82250000010023138010000000250000000000000000121042882 121042880000001
9000001000001000000010023138010000000250000000000000000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
11 changes: 1 addition & 10 deletions test/ach-arc-write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"time"

"github.com/moov-io/ach"
Expand Down Expand Up @@ -58,15 +57,7 @@ func main() {
}

// write the file to std out. Anything io.Writer
fd, err := os.Create(filepath.Join("..", "ach-arc-read", "arc-debit.ach"))
if err != nil {
log.Fatalf("Unexpected error creating output file: %s\n", err)
}
defer func() {
fd.Sync()
fd.Close()
}()
w := ach.NewWriter(fd)
w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
Expand Down
6 changes: 3 additions & 3 deletions test/ach-atx-read/atx-read.ach
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
101 031300012 2313801041904120000A094101Federal Reserve Bank My Bank Name
5220Name on Account 231380104 ATXVndr Pay 190413 1231380100000001
101 031300012 2313801041810290000A094101Federal Reserve Bank My Bank Name
5220Name on Account 231380104 ATXVndr Pay 181030 1231380100000001
624031300012744-5678-99 00000000000313000100000010002Receiver Company 011231380100000001
705Credit account 1 for service 00010000001
705Credit account 2 for service 00020000001
624031300012744-5678-99 00000000000313000100000020002Receiver Company 011231380100000002
705Credit account 1 for leadership 00010000002
705Credit account 2 for leadership 00020000002
82200000060006260002000000000000000000000000231380104 231380100000001
9000001000001000000060006260002000000000000000000000000
9000001000001000000060006260002000000000000000000000000
11 changes: 1 addition & 10 deletions test/ach-atx-write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"time"

"github.com/moov-io/ach"
Expand Down Expand Up @@ -100,15 +99,7 @@ func main() {
}

// write the file to std out. Anything io.Writer
fd, err := os.Create(filepath.Join("..", "ach-atx-read", "atx-read.ach"))
if err != nil {
log.Fatalf("Unexpected error creating output file: %s\n", err)
}
defer func() {
fd.Sync()
fd.Close()
}()
w := ach.NewWriter(fd)
w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
Expand Down
6 changes: 3 additions & 3 deletions test/ach-boc-read/boc-debit.ach
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
101 231380104 1210428821904120000A094101Federal Reserve Bank My Bank Name
5225Payee Name 121042882 BOCACH BOC 190413 1121042880000001
101 231380104 1210428821806070000A094101Federal Reserve Bank My Bank Name
5225Payee Name 121042882 BOCACH BOC 180608 1121042880000001
62723138010412345678 0000250000123879654 ABC Company 0121042880000001
82250000010023138010000000250000000000000000121042882 121042880000001
9000001000001000000010023138010000000250000000000000000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
11 changes: 1 addition & 10 deletions test/ach-boc-write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"time"

"github.com/moov-io/ach"
Expand Down Expand Up @@ -58,15 +57,7 @@ func main() {
}

// write the file to std out. Anything io.Writer
fd, err := os.Create(filepath.Join("..", "ach-boc-read", "boc-debit.ach"))
if err != nil {
log.Fatalf("Unexpected error creating output file: %s\n", err)
}
defer func() {
fd.Sync()
fd.Close()
}()
w := ach.NewWriter(fd)
w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
Expand Down
6 changes: 3 additions & 3 deletions test/ach-ccd-read/ccd-debit.ach
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
101 231380104 0313000121904120000A094101Federal Reserve Bank My Bank Name
5225Name on Account 031300012 CCDVndr Pay 190413 1031300010000001
101 231380104 0313000121811260000A094101Federal Reserve Bank My Bank Name
5225Name on Account 031300012 CCDVndr Pay 181127 1031300010000001
627231380104744-5678-99 0000500000location #1 Best Co. #1 S 0031300010000001
627231380104744-5678-99 0000000125Fee #1 Best Co. #1 S 0031300010000002
82250000020046276020000000500125000000000000031300012 031300010000001
9000001000001000000020046276020000000500125000000000000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
11 changes: 1 addition & 10 deletions test/ach-ccd-write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"time"

"github.com/moov-io/ach"
Expand Down Expand Up @@ -72,15 +71,7 @@ func main() {
}

// write the file to std out. Anything io.Writer
fd, err := os.Create(filepath.Join("..", "ach-ccd-read", "ccd-debit.ach"))
if err != nil {
log.Fatalf("Unexpected error creating output file: %s\n", err)
}
defer func() {
fd.Sync()
fd.Close()
}()
w := ach.NewWriter(fd)
w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
Expand Down
6 changes: 3 additions & 3 deletions test/ach-cie-read/cie-credit.ach
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
101 231380104 1210428821904120000A094101Federal Reserve Bank My Bank Name
5220Name on Account 121042882 CIEPayment 190413 1121042880000001
101 231380104 1210428821806200000A094101Federal Reserve Bank My Bank Name
5220Name on Account 121042882 CIEPayment 180621 1121042880000001
62223138010412345678 0100000000 Receiver Account Name 011121042880000001
705Credit Store Account 00010000001
82200000020023138010000000000000000100000000121042882 121042880000001
9000001000001000000020023138010000000000000000100000000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
11 changes: 1 addition & 10 deletions test/ach-cie-write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"time"

"github.com/moov-io/ach"
Expand Down Expand Up @@ -68,15 +67,7 @@ func main() {
}

// write the file to std out. Anything io.Writer
fd, err := os.Create(filepath.Join("..", "ach-cie-read", "cie-credit.ach"))
if err != nil {
log.Fatalf("Unexpected error creating output file: %s\n", err)
}
defer func() {
fd.Sync()
fd.Close()
}()
w := ach.NewWriter(fd)
w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
Expand Down
6 changes: 3 additions & 3 deletions test/ach-ctx-read/ctx-debit.ach
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
101 231380104 1210428821904120000A094101Federal Reserve Bank My Bank Name
5225Name on Account 121042882 CTXACH CTX 190413 1121042880000001
101 231380104 1210428821811260000A094101Federal Reserve Bank My Bank Name
5225Name on Account 121042882 CTXACH CTX 181127 1121042880000001
62723138010412345678 010000000045689033 0002Receiver Company 011121042880000001
705Debit First Account 00010000001
705Debit Second Account 00020000001
82250000030023138010000100000000000000000000121042882 121042880000001
9000001000001000000030023138010000100000000000000000000
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
9999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999
11 changes: 1 addition & 10 deletions test/ach-ctx-write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"time"

"github.com/moov-io/ach"
Expand Down Expand Up @@ -75,15 +74,7 @@ func main() {
}

// write the file to std out. Anything io.Writer
fd, err := os.Create(filepath.Join("..", "ach-ctx-read", "ctx-debit.ach"))
if err != nil {
log.Fatalf("Unexpected error creating output file: %s\n", err)
}
defer func() {
fd.Sync()
fd.Close()
}()
w := ach.NewWriter(fd)
w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
Expand Down
4 changes: 2 additions & 2 deletions test/ach-dne-read/dne-read.ach
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
101 031300012 2313801041904120000A094101Federal Reserve Bank My Bank Name
5220Name on Account 231380104 DNEDeath 190413 2231380100000001
101 031300012 2313801041811020000A094101Federal Reserve Bank My Bank Name
5220Name on Account 231380104 DNEDeath 181103 2231380100000001
621031300012744-5678-99 0000000000031300010000001Best. #1 1231380100000001
705 DATE OF DEATH*010218*CUSTOMERSSN*#########*AMOUNT*$$$$.cc\ 00010000001
82200000020003130001000000000000000000000000231380104 231380100000001
Expand Down
11 changes: 1 addition & 10 deletions test/ach-dne-write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"time"

"github.com/moov-io/ach"
Expand Down Expand Up @@ -66,15 +65,7 @@ func main() {
}

// write the file to std out. Anything io.Writer
fd, err := os.Create(filepath.Join("..", "ach-dne-read", "dne-read.ach"))
if err != nil {
log.Fatalf("Unexpected error creating output file: %s\n", err)
}
defer func() {
fd.Sync()
fd.Close()
}()
w := ach.NewWriter(fd)
w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
Expand Down
2 changes: 1 addition & 1 deletion test/ach-enr-read/enr-read.ach
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
101 031300012 2313801041904120000A094101Federal Reserve Bank My Bank Name
101 031300012 2313801041811260000A094101Federal Reserve Bank My Bank Name
5225Name on Account 231380104 ENRAUTOENROLL 1231380100000001
627031300012744-5678-99 0000000000031300010000001Best. #1 1231380100000001
70522*12200004*3*123987654321*777777777*DOE*JOHN*1\ 00010000001
Expand Down
11 changes: 1 addition & 10 deletions test/ach-enr-write/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package main
import (
"log"
"os"
"path/filepath"
"time"

"github.com/moov-io/ach"
Expand Down Expand Up @@ -64,15 +63,7 @@ func main() {
}

// write the file to std out. Anything io.Writer
fd, err := os.Create(filepath.Join("..", "ach-enr-read", "enr-read.ach"))
if err != nil {
log.Fatalf("Unexpected error creating output file: %s\n", err)
}
defer func() {
fd.Sync()
fd.Close()
}()
w := ach.NewWriter(fd)
w := ach.NewWriter(os.Stdout)
if err := w.Write(file); err != nil {
log.Fatalf("Unexpected error: %s\n", err)
}
Expand Down
Loading

0 comments on commit 5f8dc7e

Please sign in to comment.