-
Notifications
You must be signed in to change notification settings - Fork 5
feat: add add subcommand
#16
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
Changes from 1 commit
26a846b
39dc847
65485be
7e5ea3a
ed4fe0e
ccb3077
75f8c47
d232da9
893eec9
3e8c3d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,15 +4,21 @@ | |
| import pytest | ||
|
|
||
|
|
||
| @pytest.mark.parametrize("all_flag", ["-A", "--all", "--no-ignore-removal"]) | ||
| @pytest.mark.parametrize("all_flag", ["", "-A", "--all", "--no-ignore-removal"]) | ||
| def test_add(git2cpp_path, all_flag): | ||
| with open("./test/mook_file.txt", "x") as f: | ||
| pass | ||
| f.close() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This line isn't needed as the |
||
|
|
||
| with open("./test/mook_file_2.txt", "x") as f: | ||
| pass | ||
| f.close() | ||
|
|
||
| cmd_add = [git2cpp_path, 'add'] | ||
| if all_flag != "": | ||
| cmd_add.append(all_flag) | ||
| else: | ||
| cmd_add.append("test/mook_file.txt") | ||
| subprocess.run(cmd_add, capture_output=True, text=True) | ||
|
|
||
| cmd_status = [git2cpp_path, 'status', "--long"] | ||
|
|
@@ -27,3 +33,5 @@ def test_add(git2cpp_path, all_flag): | |
| # assert "modified" in p.stdout | ||
| # | ||
| os.remove("./test/mook_file.txt") | ||
| os.remove("./test/mook_file_2.txt") | ||
| subprocess.run(cmd_add, capture_output=True, text=True) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this line just to undo the add, to leave the test directory at the end the same as it was at the start? If so can you add a comment saying this, otherwise it will look suspicious in future to have this line without any following
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that's the reason why ! I'll write a comment. |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This leaks. I think it would be worth having a wrapper of
git_strarray, that correctly manages the memory and use it here. It will be useful for other commands anyway.