Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KarolNi
Copy link

@KarolNi KarolNi commented Jan 11, 2021

Implemented solution to #39 proposed by @tmtben

@DeflateAwning
Copy link

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

@kevinp2
Copy link

kevinp2 commented Jun 6, 2025

@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

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