Skip to content

added ability to compare files with different number of columns - #47

Open
KarolNi wants to merge 1 commit into
aswinkarthik:masterfrom
KarolNi:master
Open

added ability to compare files with different number of columns#47
KarolNi wants to merge 1 commit into
aswinkarthik:masterfrom
KarolNi:master

Conversation

@KarolNi

@KarolNi KarolNi commented Jan 11, 2021

Copy link
Copy Markdown

Implemented solution to #39 proposed by @tmtben

@DeflateAwning

Copy link
Copy Markdown

Please merge this request! This is a very useful feature!

@kevinp2

kevinp2 commented Jun 6, 2025

Copy link
Copy Markdown

@aswinkarthik appears to have gone inactive on GitHub.

@aswinkarthik, would you be able to merge this? Or consider giving the repository to another maintainer to carry on with?

@eslgastal

Copy link
Copy Markdown

The following test is not passing after applying this patch/PR:

csvdiff/cmd/config_test.go

Lines 244 to 272 in 1007bf3

t.Run("should validate if positions are within the limits of the csv file", func(t *testing.T) {
fs := afero.NewMemMapFs()
{
baseContent := []byte("id,name,age,desc")
err := afero.WriteFile(fs, "/base.csv", baseContent, os.ModePerm)
assert.NoError(t, err)
}
{
deltaContent := []byte("id,name,age,desc")
err := afero.WriteFile(fs, "/delta.csv", deltaContent, os.ModePerm)
assert.NoError(t, err)
}
t.Run("primary key positions", func(t *testing.T) {
_, err := cmd.NewContext(
fs,
[]int{4},
nil,
nil,
nil,
"json",
"/base.csv",
"/delta.csv",
',',
false,
)
assert.EqualError(t, err, "validation failed: --primary-key positions are out of bounds")
})

--- FAIL: TestNewContext (0.00s)
    --- FAIL: TestNewContext/should_validate_if_positions_are_within_the_limits_of_the_csv_file (0.00s)
        --- FAIL: TestNewContext/should_validate_if_positions_are_within_the_limits_of_the_csv_file/inequal_base_and_delta_files (0.00s)
            config_test.go:327: 
                        Error Trace:    config_test.go:327
                        Error:          Error message not equal:
                                        expected: "base-file and delta-file columns count do not match"
                                        actual  : "base-file and delta-file columns count do not match and columns to selective compare not specified"
                        Test:           TestNewContext/should_validate_if_positions_are_within_the_limits_of_the_csv_file/inequal_base_and_delta_files

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants