From d38c8ca717c96b0544f58fe8bd727d37bb270764 Mon Sep 17 00:00:00 2001 From: Florian Bachmann Date: Tue, 10 Mar 2020 16:37:16 +0100 Subject: [PATCH 1/4] added .gitignore --- .gitignore | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f3749bb --- /dev/null +++ b/.gitignore @@ -0,0 +1,90 @@ +# Created by .ignore support plugin (hsz.mobi) +### Go template +# Binaries for programs and plugins +*.exe +*.exe~ +*.dll +*.so +*.dylib + +# Test binary, built with `go test -c` +*.test + +# Output of the go coverage tool, specifically when used with LiteIDE +*.out + +# Dependency directories (remove the comment below to include it) +# vendor/ + +### JetBrains template +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +# User-specific stuff +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf + +# Generated files +.idea/**/contentModel.xml + +# Sensitive or high-churn files +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml + +# Gradle +.idea/**/gradle.xml +.idea/**/libraries + +# Gradle and Maven with auto-import +# When using Gradle or Maven with auto-import, you should exclude module files, +# since they will be recreated, and may cause churn. Uncomment if using +# auto-import. +# .idea/artifacts +# .idea/compiler.xml +# .idea/modules.xml +# .idea/*.iml +# .idea/modules +# *.iml +# *.ipr + +# CMake +cmake-build-*/ + +# Mongo Explorer plugin +.idea/**/mongoSettings.xml + +# File-based project format +*.iws + +# IntelliJ +out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Cursive Clojure plugin +.idea/replstate.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# Editor-based Rest Client +.idea/httpRequests + +# Android studio 3.1+ serialized cache file +.idea/caches/build_file_checksums.ser + From d52a96dc46deb994e510d94cfc03d2b1bc263e98 Mon Sep 17 00:00:00 2001 From: Florian Bachmann Date: Tue, 10 Mar 2020 16:41:02 +0100 Subject: [PATCH 2/4] added golang.org/x/text to go.mod --- go.mod | 3 +++ go.sum | 6 ++++++ 2 files changed, 9 insertions(+) create mode 100644 go.sum diff --git a/go.mod b/go.mod index f049e9c..403f525 100644 --- a/go.mod +++ b/go.mod @@ -1,7 +1,10 @@ module github.com/moogle19/dbf +go 1.14 + require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/stretchr/testify v1.2.2 + golang.org/x/text v0.3.2 ) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..f117b51 --- /dev/null +++ b/go.sum @@ -0,0 +1,6 @@ +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= From 8b7219d06edea5bdf7be9b91d5040d4cbcd56d0d Mon Sep 17 00:00:00 2001 From: Florian Bachmann Date: Wed, 11 Mar 2020 22:18:58 +0100 Subject: [PATCH 3/4] FIXES: a column name can be shorter than 10 runes and earlier terminated by byte(0) character and added a test for it --- column.go | 7 ++-- column_test.go | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++ go.mod | 2 +- go.sum | 10 ++++++ 4 files changed, 107 insertions(+), 3 deletions(-) create mode 100644 column_test.go diff --git a/column.go b/column.go index b2c0625..6fc1d21 100644 --- a/column.go +++ b/column.go @@ -2,7 +2,6 @@ package dbf import ( "bytes" - "golang.org/x/text/encoding" ) @@ -32,7 +31,11 @@ func newColumn(rawData []byte, enc encoding.Encoding) (*Column, error) { return nil, err } } - name := string(bytes.Trim(nameData, "\x00")) + + // a column name can be shorter than 10 runes and earlier terminated by byte(0) character + neededByShortColumnNames := bytes.Split(nameData, []byte("\x00")) + byteRespTrim := bytes.Trim(neededByShortColumnNames[0], "\x00") + name := string(byteRespTrim) ct, err := getColumnType(rawData[11]) if err != nil { diff --git a/column_test.go b/column_test.go new file mode 100644 index 0000000..4c0fb8d --- /dev/null +++ b/column_test.go @@ -0,0 +1,91 @@ +package dbf + +import ( + "github.com/stretchr/testify/assert" + "golang.org/x/text/encoding" + "golang.org/x/text/encoding/charmap" + "testing" +) + +/** + * a column name can be shorter than 10 runes and earlier terminated by byte(0) character + */ +func Test_newColumn(t *testing.T) { + type args struct { + rawData []byte + enc encoding.Encoding + } + type result struct { + name string + typeOf ColumnType + } + + tests := []struct { + name string + args args + want result + }{ + { name: "KUHNUMMER", args: args{[]byte{75, 85, 72, 78, 85, 77, 77, 69, 82, 0, 0, 78, 5, 0, 193, 57, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KUHNUMMER", TypeNumber}}, + { name: "RD_NR", args: args{[]byte{82, 68, 95, 78, 82, 0, 0, 0, 0, 0, 0, 78, 9, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"RD_NR", TypeNumber}}, + { name: "BULLENNR4", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 52, 0, 0, 78, 12, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR4", TypeNumber}}, + { name: "BULLENNR3", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 51, 0, 0, 78, 15, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR3", TypeNumber}}, + { name: "BULLENNR2", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 50, 0, 0, 78, 18, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR2", TypeNumber}}, + { name: "BULLENNR1", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 49, 0, 0, 78, 21, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR1", TypeNumber}}, + { name: "SPEICHER", args: args{[]byte{83, 80, 69, 73, 67, 72, 69, 82, 0, 82, 0, 76, 24, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"SPEICHER", TypeBool}}, + { name: "KOMMENT4", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 52, 0, 82, 0, 67, 25, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT4", TypeText}}, + { name: "KOMMENT3", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 51, 0, 82, 0, 67, 47, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT3", TypeText}}, + { name: "KOMMENT2", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 50, 0, 82, 0, 67, 69, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT2", TypeText}}, + { name: "KOMMENT1", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 49, 0, 82, 0, 67, 91, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT1", TypeText}}, + { name: "TRAG", args: args{[]byte{84, 82, 65, 71, 0, 78, 68, 49, 0, 83, 67, 76, 113, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TRAG", TypeBool}}, + { name: "BULLE4", args: args{[]byte{66, 85, 76, 76, 69, 52, 0, 0, 46, 68, 66, 67, 114, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE4", TypeText}}, + { name: "BULLE3", args: args{[]byte{66, 85, 76, 76, 69, 51, 0, 0, 46, 68, 66, 67, 126, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE3", TypeText}}, + { name: "BULLE2", args: args{[]byte{66, 85, 76, 76, 69, 50, 0, 0, 46, 68, 66, 67, 138, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE2", TypeText}}, + { name: "DATUM_1BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 49, 66, 69, 83, 0, 68, 150, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_1BES", TypeDate}}, + { name: "BULLE1", args: args{[]byte{66, 85, 76, 76, 69, 49, 0, 0, 0, 0, 0, 67, 158, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE1", TypeText}}, + { name: "DATUM_2BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 50, 66, 69, 83, 0, 68, 170, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_2BES", TypeDate}}, + { name: "DATUM_3BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 51, 66, 69, 83, 0, 68, 178, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_3BES", TypeDate}}, + { name: "DATUM_4BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 52, 66, 69, 83, 0, 68, 186, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_4BES", TypeDate}}, + { name: "ABKALBUNG", args: args{[]byte{65, 66, 75, 65, 76, 66, 85, 78, 71, 0, 0, 68, 194, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"ABKALBUNG", TypeDate}}, + { name: "TRA", args: args{[]byte{84, 82, 65, 0, 0, 0, 0, 0, 0, 0, 0, 67, 202, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TRA", TypeText}}, + { name: "NR", args: args{[]byte{78, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 203, 0, 193, 57, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"NR", TypeNumber}}, + { name: "AKTBESDAT", args: args{[]byte{65, 75, 84, 66, 69, 83, 68, 65, 84, 0, 0, 68, 205, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"AKTBESDAT", TypeDate}}, + { name: "BULLE", args: args{[]byte{66, 85, 76, 76, 69, 0, 0, 0, 0, 0, 0, 67, 213, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE", TypeText}}, + { name: "STATUS", args: args{[]byte{83, 84, 65, 84, 85, 83, 0, 0, 0, 0, 0, 78, 225, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"STATUS", TypeNumber}}, + { name: "LEBENSNR", args: args{[]byte{76, 69, 66, 69, 78, 83, 78, 82, 0, 0, 0, 78, 226, 0, 193, 57, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"LEBENSNR", TypeNumber}}, + { name: "TRAGETAGE", args: args{[]byte{84, 82, 65, 71, 69, 84, 65, 71, 69, 0, 0, 78, 235, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TRAGETAGE", TypeNumber}}, + { name: "KALBGE", args: args{[]byte{75, 65, 76, 66, 71, 69, 0, 0, 0, 0, 0, 78, 238, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBGE", TypeNumber}}, + { name: "GEBURTSV", args: args{[]byte{71, 69, 66, 85, 82, 84, 83, 86, 0, 0, 0, 78, 239, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"GEBURTSV", TypeNumber}}, + { name: "LAKTAGE", args: args{[]byte{76, 65, 75, 84, 65, 71, 69, 0, 0, 0, 0, 78, 240, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"LAKTAGE", TypeNumber}}, + { name: "LK_AK", args: args{[]byte{76, 75, 95, 65, 75, 0, 0, 0, 0, 0, 0, 68, 243, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"LK_AK", TypeDate}}, + { name: "VERBLEIB", args: args{[]byte{86, 69, 82, 66, 76, 69, 73, 66, 0, 0, 0, 78, 251, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"VERBLEIB", TypeNumber}}, + { name: "KALBNR", args: args{[]byte{75, 65, 76, 66, 78, 82, 0, 0, 0, 0, 0, 78, 252, 0, 193, 57, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBNR", TypeNumber}}, + { name: "ZKZ", args: args{[]byte{90, 75, 90, 0, 0, 0, 0, 0, 0, 0, 0, 78, 5, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"ZKZ", TypeNumber}}, + { name: "KALBKOM", args: args{[]byte{75, 65, 76, 66, 75, 79, 77, 0, 0, 0, 0, 67, 8, 1, 193, 57, 30, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBKOM", TypeText}}, + { name: "EKALTER", args: args{[]byte{69, 75, 65, 76, 84, 69, 82, 0, 0, 0, 0, 78, 38, 1, 193, 57, 4, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"EKALTER", TypeNumber}}, + { name: "EKA", args: args{[]byte{69, 75, 65, 0, 0, 0, 0, 0, 0, 0, 0, 78, 42, 1, 193, 57, 4, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"EKA", TypeNumber}}, + { name: "KALBTAGE1", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 49, 0, 0, 78, 46, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE1", TypeNumber}}, + { name: "KALBTAGE2", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 50, 0, 0, 78, 49, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE2", TypeNumber}}, + { name: "KALBTAGE3", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 51, 0, 0, 78, 52, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE3", TypeNumber}}, + { name: "KALBTAGE4", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 52, 0, 0, 78, 55, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE4", TypeNumber}}, + { name: "DTRAGETAGE", args: args{[]byte{68, 84, 82, 65, 71, 69, 84, 65, 71, 69, 0, 78, 58, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DTRAGETAGE", TypeNumber}}, + { name: "RASSE", args: args{[]byte{82, 65, 83, 83, 69, 0, 0, 0, 0, 0, 0, 78, 61, 1, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"RASSE", TypeNumber}}, + { name: "TROCKENGES", args: args{[]byte{84, 82, 79, 67, 75, 69, 78, 71, 69, 83, 0, 68, 62, 1, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TROCKENGES", TypeDate}}, + { name: "PAG", args: args{[]byte{80, 65, 71, 0, 0, 0, 0, 0, 0, 0, 0, 78, 70, 1, 193, 57, 4, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"PAG", TypeNumber}}, + { name: "IM", args: args{[]byte{73, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 74, 1, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"IM", TypeDate}}, + { name: "TS", args: args{[]byte{84, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 82, 1, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TS", TypeBool}}, + { name: "IM2", args: args{[]byte{73, 77, 50, 0, 0, 0, 0, 0, 0, 0, 0, 68, 83, 1, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"IM2", TypeDate}}, + + + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := newColumn(tt.args.rawData, tt.args.enc) + if err != nil { + t.Errorf("newColumn() error = %v", err) + return + } + assert.Equal(t, tt.want.name, got.Name) + assert.Equal(t, tt.want.typeOf, got.Type) + }) + } +} diff --git a/go.mod b/go.mod index 403f525..188729e 100644 --- a/go.mod +++ b/go.mod @@ -5,6 +5,6 @@ go 1.14 require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/testify v1.2.2 + github.com/stretchr/testify v1.5.1 golang.org/x/text v0.3.2 ) diff --git a/go.sum b/go.sum index f117b51..e510bd1 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,16 @@ +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= From 6ae162ceacd7665f67518a565bb2ce1250fec6bb Mon Sep 17 00:00:00 2001 From: Florian Bachmann Date: Tue, 24 Oct 2023 23:01:52 +0200 Subject: [PATCH 4/4] updated go version --- .gitignore | 12 +- .idea/.gitignore | 8 + .idea/dbf.iml | 9 + .idea/inspectionProfiles/Project_Default.xml | 18 ++ .idea/misc.xml | 6 + .idea/modules.xml | 8 + .idea/vcs.xml | 6 + column.go | 1 + column_test.go | 109 +++++---- dbf.go | 3 +- field_test.go | 237 +++++++++++++++++++ go.mod | 12 +- go.sum | 20 +- 13 files changed, 384 insertions(+), 65 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/dbf.iml create mode 100644 .idea/inspectionProfiles/Project_Default.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 field_test.go diff --git a/.gitignore b/.gitignore index f3749bb..9be364b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -# Created by .ignore support plugin (hsz.mobi) -### Go template +# If you prefer the allow list template instead of the deny list, see community template: +# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore +# # Binaries for programs and plugins *.exe *.exe~ @@ -16,6 +17,12 @@ # Dependency directories (remove the comment below to include it) # vendor/ +# Go workspace file +go.work + +# Dependency directories (remove the comment below to include it) +# vendor/ + ### JetBrains template # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 @@ -87,4 +94,3 @@ fabric.properties # Android studio 3.1+ serialized cache file .idea/caches/build_file_checksums.ser - diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..73f69e0 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/dbf.iml b/.idea/dbf.iml new file mode 100644 index 0000000..5e764c4 --- /dev/null +++ b/.idea/dbf.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000..04b6026 --- /dev/null +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,18 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..93d3993 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/column.go b/column.go index 6fc1d21..05dadbc 100644 --- a/column.go +++ b/column.go @@ -2,6 +2,7 @@ package dbf import ( "bytes" + "golang.org/x/text/encoding" ) diff --git a/column_test.go b/column_test.go index 4c0fb8d..9af10f3 100644 --- a/column_test.go +++ b/column_test.go @@ -1,10 +1,11 @@ package dbf import ( + "testing" + "github.com/stretchr/testify/assert" "golang.org/x/text/encoding" "golang.org/x/text/encoding/charmap" - "testing" ) /** @@ -21,61 +22,59 @@ func Test_newColumn(t *testing.T) { } tests := []struct { - name string - args args - want result + name string + args args + want result }{ - { name: "KUHNUMMER", args: args{[]byte{75, 85, 72, 78, 85, 77, 77, 69, 82, 0, 0, 78, 5, 0, 193, 57, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KUHNUMMER", TypeNumber}}, - { name: "RD_NR", args: args{[]byte{82, 68, 95, 78, 82, 0, 0, 0, 0, 0, 0, 78, 9, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"RD_NR", TypeNumber}}, - { name: "BULLENNR4", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 52, 0, 0, 78, 12, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR4", TypeNumber}}, - { name: "BULLENNR3", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 51, 0, 0, 78, 15, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR3", TypeNumber}}, - { name: "BULLENNR2", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 50, 0, 0, 78, 18, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR2", TypeNumber}}, - { name: "BULLENNR1", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 49, 0, 0, 78, 21, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR1", TypeNumber}}, - { name: "SPEICHER", args: args{[]byte{83, 80, 69, 73, 67, 72, 69, 82, 0, 82, 0, 76, 24, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"SPEICHER", TypeBool}}, - { name: "KOMMENT4", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 52, 0, 82, 0, 67, 25, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT4", TypeText}}, - { name: "KOMMENT3", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 51, 0, 82, 0, 67, 47, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT3", TypeText}}, - { name: "KOMMENT2", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 50, 0, 82, 0, 67, 69, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT2", TypeText}}, - { name: "KOMMENT1", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 49, 0, 82, 0, 67, 91, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT1", TypeText}}, - { name: "TRAG", args: args{[]byte{84, 82, 65, 71, 0, 78, 68, 49, 0, 83, 67, 76, 113, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TRAG", TypeBool}}, - { name: "BULLE4", args: args{[]byte{66, 85, 76, 76, 69, 52, 0, 0, 46, 68, 66, 67, 114, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE4", TypeText}}, - { name: "BULLE3", args: args{[]byte{66, 85, 76, 76, 69, 51, 0, 0, 46, 68, 66, 67, 126, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE3", TypeText}}, - { name: "BULLE2", args: args{[]byte{66, 85, 76, 76, 69, 50, 0, 0, 46, 68, 66, 67, 138, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE2", TypeText}}, - { name: "DATUM_1BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 49, 66, 69, 83, 0, 68, 150, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_1BES", TypeDate}}, - { name: "BULLE1", args: args{[]byte{66, 85, 76, 76, 69, 49, 0, 0, 0, 0, 0, 67, 158, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE1", TypeText}}, - { name: "DATUM_2BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 50, 66, 69, 83, 0, 68, 170, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_2BES", TypeDate}}, - { name: "DATUM_3BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 51, 66, 69, 83, 0, 68, 178, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_3BES", TypeDate}}, - { name: "DATUM_4BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 52, 66, 69, 83, 0, 68, 186, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_4BES", TypeDate}}, - { name: "ABKALBUNG", args: args{[]byte{65, 66, 75, 65, 76, 66, 85, 78, 71, 0, 0, 68, 194, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"ABKALBUNG", TypeDate}}, - { name: "TRA", args: args{[]byte{84, 82, 65, 0, 0, 0, 0, 0, 0, 0, 0, 67, 202, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TRA", TypeText}}, - { name: "NR", args: args{[]byte{78, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 203, 0, 193, 57, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"NR", TypeNumber}}, - { name: "AKTBESDAT", args: args{[]byte{65, 75, 84, 66, 69, 83, 68, 65, 84, 0, 0, 68, 205, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"AKTBESDAT", TypeDate}}, - { name: "BULLE", args: args{[]byte{66, 85, 76, 76, 69, 0, 0, 0, 0, 0, 0, 67, 213, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE", TypeText}}, - { name: "STATUS", args: args{[]byte{83, 84, 65, 84, 85, 83, 0, 0, 0, 0, 0, 78, 225, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"STATUS", TypeNumber}}, - { name: "LEBENSNR", args: args{[]byte{76, 69, 66, 69, 78, 83, 78, 82, 0, 0, 0, 78, 226, 0, 193, 57, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"LEBENSNR", TypeNumber}}, - { name: "TRAGETAGE", args: args{[]byte{84, 82, 65, 71, 69, 84, 65, 71, 69, 0, 0, 78, 235, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TRAGETAGE", TypeNumber}}, - { name: "KALBGE", args: args{[]byte{75, 65, 76, 66, 71, 69, 0, 0, 0, 0, 0, 78, 238, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBGE", TypeNumber}}, - { name: "GEBURTSV", args: args{[]byte{71, 69, 66, 85, 82, 84, 83, 86, 0, 0, 0, 78, 239, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"GEBURTSV", TypeNumber}}, - { name: "LAKTAGE", args: args{[]byte{76, 65, 75, 84, 65, 71, 69, 0, 0, 0, 0, 78, 240, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"LAKTAGE", TypeNumber}}, - { name: "LK_AK", args: args{[]byte{76, 75, 95, 65, 75, 0, 0, 0, 0, 0, 0, 68, 243, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"LK_AK", TypeDate}}, - { name: "VERBLEIB", args: args{[]byte{86, 69, 82, 66, 76, 69, 73, 66, 0, 0, 0, 78, 251, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"VERBLEIB", TypeNumber}}, - { name: "KALBNR", args: args{[]byte{75, 65, 76, 66, 78, 82, 0, 0, 0, 0, 0, 78, 252, 0, 193, 57, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBNR", TypeNumber}}, - { name: "ZKZ", args: args{[]byte{90, 75, 90, 0, 0, 0, 0, 0, 0, 0, 0, 78, 5, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"ZKZ", TypeNumber}}, - { name: "KALBKOM", args: args{[]byte{75, 65, 76, 66, 75, 79, 77, 0, 0, 0, 0, 67, 8, 1, 193, 57, 30, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBKOM", TypeText}}, - { name: "EKALTER", args: args{[]byte{69, 75, 65, 76, 84, 69, 82, 0, 0, 0, 0, 78, 38, 1, 193, 57, 4, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"EKALTER", TypeNumber}}, - { name: "EKA", args: args{[]byte{69, 75, 65, 0, 0, 0, 0, 0, 0, 0, 0, 78, 42, 1, 193, 57, 4, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"EKA", TypeNumber}}, - { name: "KALBTAGE1", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 49, 0, 0, 78, 46, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE1", TypeNumber}}, - { name: "KALBTAGE2", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 50, 0, 0, 78, 49, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE2", TypeNumber}}, - { name: "KALBTAGE3", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 51, 0, 0, 78, 52, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE3", TypeNumber}}, - { name: "KALBTAGE4", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 52, 0, 0, 78, 55, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE4", TypeNumber}}, - { name: "DTRAGETAGE", args: args{[]byte{68, 84, 82, 65, 71, 69, 84, 65, 71, 69, 0, 78, 58, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DTRAGETAGE", TypeNumber}}, - { name: "RASSE", args: args{[]byte{82, 65, 83, 83, 69, 0, 0, 0, 0, 0, 0, 78, 61, 1, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"RASSE", TypeNumber}}, - { name: "TROCKENGES", args: args{[]byte{84, 82, 79, 67, 75, 69, 78, 71, 69, 83, 0, 68, 62, 1, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TROCKENGES", TypeDate}}, - { name: "PAG", args: args{[]byte{80, 65, 71, 0, 0, 0, 0, 0, 0, 0, 0, 78, 70, 1, 193, 57, 4, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"PAG", TypeNumber}}, - { name: "IM", args: args{[]byte{73, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 74, 1, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"IM", TypeDate}}, - { name: "TS", args: args{[]byte{84, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 82, 1, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TS", TypeBool}}, - { name: "IM2", args: args{[]byte{73, 77, 50, 0, 0, 0, 0, 0, 0, 0, 0, 68, 83, 1, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"IM2", TypeDate}}, - - + {name: "KUHNUMMER", args: args{[]byte{75, 85, 72, 78, 85, 77, 77, 69, 82, 0, 0, 78, 5, 0, 193, 57, 4, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KUHNUMMER", TypeNumber}}, + {name: "RD_NR", args: args{[]byte{82, 68, 95, 78, 82, 0, 0, 0, 0, 0, 0, 78, 9, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"RD_NR", TypeNumber}}, + {name: "BULLENNR4", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 52, 0, 0, 78, 12, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR4", TypeNumber}}, + {name: "BULLENNR3", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 51, 0, 0, 78, 15, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR3", TypeNumber}}, + {name: "BULLENNR2", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 50, 0, 0, 78, 18, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR2", TypeNumber}}, + {name: "BULLENNR1", args: args{[]byte{66, 85, 76, 76, 69, 78, 78, 82, 49, 0, 0, 78, 21, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLENNR1", TypeNumber}}, + {name: "SPEICHER", args: args{[]byte{83, 80, 69, 73, 67, 72, 69, 82, 0, 82, 0, 76, 24, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"SPEICHER", TypeBool}}, + {name: "KOMMENT4", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 52, 0, 82, 0, 67, 25, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT4", TypeText}}, + {name: "KOMMENT3", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 51, 0, 82, 0, 67, 47, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT3", TypeText}}, + {name: "KOMMENT2", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 50, 0, 82, 0, 67, 69, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT2", TypeText}}, + {name: "KOMMENT1", args: args{[]byte{75, 79, 77, 77, 69, 78, 84, 49, 0, 82, 0, 67, 91, 0, 193, 57, 22, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KOMMENT1", TypeText}}, + {name: "TRAG", args: args{[]byte{84, 82, 65, 71, 0, 78, 68, 49, 0, 83, 67, 76, 113, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TRAG", TypeBool}}, + {name: "BULLE4", args: args{[]byte{66, 85, 76, 76, 69, 52, 0, 0, 46, 68, 66, 67, 114, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE4", TypeText}}, + {name: "BULLE3", args: args{[]byte{66, 85, 76, 76, 69, 51, 0, 0, 46, 68, 66, 67, 126, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE3", TypeText}}, + {name: "BULLE2", args: args{[]byte{66, 85, 76, 76, 69, 50, 0, 0, 46, 68, 66, 67, 138, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE2", TypeText}}, + {name: "DATUM_1BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 49, 66, 69, 83, 0, 68, 150, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_1BES", TypeDate}}, + {name: "BULLE1", args: args{[]byte{66, 85, 76, 76, 69, 49, 0, 0, 0, 0, 0, 67, 158, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE1", TypeText}}, + {name: "DATUM_2BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 50, 66, 69, 83, 0, 68, 170, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_2BES", TypeDate}}, + {name: "DATUM_3BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 51, 66, 69, 83, 0, 68, 178, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_3BES", TypeDate}}, + {name: "DATUM_4BES", args: args{[]byte{68, 65, 84, 85, 77, 95, 52, 66, 69, 83, 0, 68, 186, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DATUM_4BES", TypeDate}}, + {name: "ABKALBUNG", args: args{[]byte{65, 66, 75, 65, 76, 66, 85, 78, 71, 0, 0, 68, 194, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"ABKALBUNG", TypeDate}}, + {name: "TRA", args: args{[]byte{84, 82, 65, 0, 0, 0, 0, 0, 0, 0, 0, 67, 202, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TRA", TypeText}}, + {name: "NR", args: args{[]byte{78, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 78, 203, 0, 193, 57, 2, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"NR", TypeNumber}}, + {name: "AKTBESDAT", args: args{[]byte{65, 75, 84, 66, 69, 83, 68, 65, 84, 0, 0, 68, 205, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"AKTBESDAT", TypeDate}}, + {name: "BULLE", args: args{[]byte{66, 85, 76, 76, 69, 0, 0, 0, 0, 0, 0, 67, 213, 0, 193, 57, 12, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"BULLE", TypeText}}, + {name: "STATUS", args: args{[]byte{83, 84, 65, 84, 85, 83, 0, 0, 0, 0, 0, 78, 225, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"STATUS", TypeNumber}}, + {name: "LEBENSNR", args: args{[]byte{76, 69, 66, 69, 78, 83, 78, 82, 0, 0, 0, 78, 226, 0, 193, 57, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"LEBENSNR", TypeNumber}}, + {name: "TRAGETAGE", args: args{[]byte{84, 82, 65, 71, 69, 84, 65, 71, 69, 0, 0, 78, 235, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TRAGETAGE", TypeNumber}}, + {name: "KALBGE", args: args{[]byte{75, 65, 76, 66, 71, 69, 0, 0, 0, 0, 0, 78, 238, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBGE", TypeNumber}}, + {name: "GEBURTSV", args: args{[]byte{71, 69, 66, 85, 82, 84, 83, 86, 0, 0, 0, 78, 239, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"GEBURTSV", TypeNumber}}, + {name: "LAKTAGE", args: args{[]byte{76, 65, 75, 84, 65, 71, 69, 0, 0, 0, 0, 78, 240, 0, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"LAKTAGE", TypeNumber}}, + {name: "LK_AK", args: args{[]byte{76, 75, 95, 65, 75, 0, 0, 0, 0, 0, 0, 68, 243, 0, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"LK_AK", TypeDate}}, + {name: "VERBLEIB", args: args{[]byte{86, 69, 82, 66, 76, 69, 73, 66, 0, 0, 0, 78, 251, 0, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"VERBLEIB", TypeNumber}}, + {name: "KALBNR", args: args{[]byte{75, 65, 76, 66, 78, 82, 0, 0, 0, 0, 0, 78, 252, 0, 193, 57, 9, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBNR", TypeNumber}}, + {name: "ZKZ", args: args{[]byte{90, 75, 90, 0, 0, 0, 0, 0, 0, 0, 0, 78, 5, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"ZKZ", TypeNumber}}, + {name: "KALBKOM", args: args{[]byte{75, 65, 76, 66, 75, 79, 77, 0, 0, 0, 0, 67, 8, 1, 193, 57, 30, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBKOM", TypeText}}, + {name: "EKALTER", args: args{[]byte{69, 75, 65, 76, 84, 69, 82, 0, 0, 0, 0, 78, 38, 1, 193, 57, 4, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"EKALTER", TypeNumber}}, + {name: "EKA", args: args{[]byte{69, 75, 65, 0, 0, 0, 0, 0, 0, 0, 0, 78, 42, 1, 193, 57, 4, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"EKA", TypeNumber}}, + {name: "KALBTAGE1", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 49, 0, 0, 78, 46, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE1", TypeNumber}}, + {name: "KALBTAGE2", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 50, 0, 0, 78, 49, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE2", TypeNumber}}, + {name: "KALBTAGE3", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 51, 0, 0, 78, 52, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE3", TypeNumber}}, + {name: "KALBTAGE4", args: args{[]byte{75, 65, 76, 66, 84, 65, 71, 69, 52, 0, 0, 78, 55, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"KALBTAGE4", TypeNumber}}, + {name: "DTRAGETAGE", args: args{[]byte{68, 84, 82, 65, 71, 69, 84, 65, 71, 69, 0, 78, 58, 1, 193, 57, 3, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"DTRAGETAGE", TypeNumber}}, + {name: "RASSE", args: args{[]byte{82, 65, 83, 83, 69, 0, 0, 0, 0, 0, 0, 78, 61, 1, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"RASSE", TypeNumber}}, + {name: "TROCKENGES", args: args{[]byte{84, 82, 79, 67, 75, 69, 78, 71, 69, 83, 0, 68, 62, 1, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TROCKENGES", TypeDate}}, + {name: "PAG", args: args{[]byte{80, 65, 71, 0, 0, 0, 0, 0, 0, 0, 0, 78, 70, 1, 193, 57, 4, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"PAG", TypeNumber}}, + {name: "IM", args: args{[]byte{73, 77, 0, 0, 0, 0, 0, 0, 0, 0, 0, 68, 74, 1, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"IM", TypeDate}}, + {name: "TS", args: args{[]byte{84, 83, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76, 82, 1, 193, 57, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"TS", TypeBool}}, + {name: "IM2", args: args{[]byte{73, 77, 50, 0, 0, 0, 0, 0, 0, 0, 0, 68, 83, 1, 193, 57, 8, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, charmap.CodePage850}, want: result{"IM2", TypeDate}}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/dbf.go b/dbf.go index 673b2d0..16bb48c 100644 --- a/dbf.go +++ b/dbf.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "io" - "io/ioutil" "os" "golang.org/x/text/encoding" @@ -48,7 +47,7 @@ func createDbfTable( t := new(Table) // read complete table - data, err := ioutil.ReadAll(ir) + data, err := io.ReadAll(ir) if err != nil { return nil, fmt.Errorf("failed to read file: %v", err) } diff --git a/field_test.go b/field_test.go new file mode 100644 index 0000000..68a1d56 --- /dev/null +++ b/field_test.go @@ -0,0 +1,237 @@ +package dbf + +import ( + "reflect" + "testing" + "time" +) + +func TestField_Bool(t *testing.T) { + type fields struct { + column *Column + value string + } + tests := []struct { + name string + fields fields + want bool + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f := &Field{ + column: tt.fields.column, + value: tt.fields.value, + } + got, err := f.Bool() + if (err != nil) != tt.wantErr { + t.Errorf("Bool() error = %v, wantErr %v", err, tt.wantErr) + return + } + if got != tt.want { + t.Errorf("Bool() got = %v, want %v", got, tt.want) + } + }) + } +} + +func TestField_Date(t *testing.T) { + type fields struct { + column *Column + value string + } + tests := []struct { + name string + fields fields + want time.Time + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f := &Field{ + column: tt.fields.column, + value: tt.fields.value, + } + got, err := f.Date() + if (err != nil) != tt.wantErr { + t.Errorf("Date() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("Date() got = %v, want %v", got, tt.want) + } + }) + } +} + +func TestField_Float(t *testing.T) { + type fields struct { + column *Column + value string + } + tests := []struct { + name string + fields fields + want float64 + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f := &Field{ + column: tt.fields.column, + value: tt.fields.value, + } + got, err := f.Float() + if (err != nil) != tt.wantErr { + t.Errorf("Float() error = %v, wantErr %v", err, tt.wantErr) + return + } + if got != tt.want { + t.Errorf("Float() got = %v, want %v", got, tt.want) + } + }) + } +} + +func TestField_Int(t *testing.T) { + type fields struct { + column *Column + value string + } + tests := []struct { + name string + fields fields + want int + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f := &Field{ + column: tt.fields.column, + value: tt.fields.value, + } + got, err := f.Int() + if (err != nil) != tt.wantErr { + t.Errorf("Int() error = %v, wantErr %v", err, tt.wantErr) + return + } + if got != tt.want { + t.Errorf("Int() got = %v, want %v", got, tt.want) + } + }) + } +} + +func TestField_Int64(t *testing.T) { + type fields struct { + column *Column + value string + } + tests := []struct { + name string + fields fields + want int64 + wantErr bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f := &Field{ + column: tt.fields.column, + value: tt.fields.value, + } + got, err := f.Int64() + if (err != nil) != tt.wantErr { + t.Errorf("Int64() error = %v, wantErr %v", err, tt.wantErr) + return + } + if got != tt.want { + t.Errorf("Int64() got = %v, want %v", got, tt.want) + } + }) + } +} + +func TestField_IsEmpty(t *testing.T) { + type fields struct { + column *Column + value string + } + tests := []struct { + name string + fields fields + want bool + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f := &Field{ + column: tt.fields.column, + value: tt.fields.value, + } + if got := f.IsEmpty(); got != tt.want { + t.Errorf("IsEmpty() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestField_Name(t *testing.T) { + type fields struct { + column *Column + value string + } + tests := []struct { + name string + fields fields + want string + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f := &Field{ + column: tt.fields.column, + value: tt.fields.value, + } + if got := f.Name(); got != tt.want { + t.Errorf("Name() = %v, want %v", got, tt.want) + } + }) + } +} + +func TestField_String(t *testing.T) { + type fields struct { + column *Column + value string + } + tests := []struct { + name string + fields fields + want string + }{ + // TODO: Add test cases. + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + f := &Field{ + column: tt.fields.column, + value: tt.fields.value, + } + if got := f.String(); got != tt.want { + t.Errorf("String() = %v, want %v", got, tt.want) + } + }) + } +} diff --git a/go.mod b/go.mod index 188729e..73aa06e 100644 --- a/go.mod +++ b/go.mod @@ -1,10 +1,16 @@ module github.com/moogle19/dbf -go 1.14 +go 1.21 + +require ( + github.com/stretchr/testify v1.8.4 + golang.org/x/text v0.13.0 +) require ( github.com/davecgh/go-spew v1.1.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect - github.com/stretchr/testify v1.5.1 - golang.org/x/text v0.3.2 + github.com/stretchr/objx v0.5.1 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index e510bd1..7803583 100644 --- a/go.sum +++ b/go.sum @@ -3,14 +3,30 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.1 h1:4VhoImhV/Bm0ToFkXFi8hXNXwpDRZ/ynw3amt82mzq0= +github.com/stretchr/objx v0.5.1/go.mod h1:/iHQpkQwBD6DLUmQ4pE+s1TXdob1mORJ4/UFdrifcy0= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= +github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= +golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= +golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=