Skip to content
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

Fix relative path test on Windows #618

Merged
merged 1 commit into from
Jul 14, 2018

Conversation

nywilken
Copy link
Contributor

This changes fixes the one test for Windows, but I am not entirely
confident that the test passing means that it will work 100% of the time
on Windows. I am still wrapping my head around how the submission stuff
should play out.

@kytrinyx
Copy link
Member

I am still wrapping my head around how the submission stuff should play out.

You and me both!

Copy link
Member

@kytrinyx kytrinyx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we can figure out the correct way to use os.PathSeparator then we can inline the test back into the main file.

@@ -55,5 +56,5 @@ func TestSubmitRelativePath(t *testing.T) {
assert.NoError(t, err)

assert.Equal(t, 1, len(submittedFiles))
assert.Equal(t, "This is a file.", submittedFiles["/file.txt"])
assert.Equal(t, "This is a file.", submittedFiles["\\file.txt"])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OMG. Of course.

This should be string(os.PathSeparator) + "file.txt" or something like that. I wonder if that will automatically escape the string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it will escape, but escaping is not needed as the key actually is \file.txt. Changing to string(os.PathSeparator) + "file.txt" works as expected. However, I have a question why does the filename need to have the path separator? Should it not just be the filename?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's what the exercism API sends back, relative to the workspace directory, including the path separator. We could have done it either way, I don't think we had any reason to do one over the other.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/sends back/expects/ (sends back on the download)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait. uhm.... is it just setup in the test that does this? In that case I think you're right, we should just remove it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the most reasonable thing right now is to keep the leading slash, since there are so many moving parts. It could be worth reconsidering down the road, as whether we change this now or later, we still have to be able to take into account the exercises that do have the leading slash.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you on this one; especially since I have not been able to give a lot of time. I would hate to start a larger thing right now and not be able to follow it all the way through.

If you are okay with it I will merge this in.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yepp, I think that's fine. I'll go ahead and merge.

@@ -30,6 +30,7 @@ func TestSubmitRelativePath(t *testing.T) {

tmpDir, err := ioutil.TempDir("", "relative-path")
assert.NoError(t, err)
defer os.RemoveAll(tmpDir)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice. I need to add this logic everywhere.

@kytrinyx
Copy link
Member

I made a tweak to the branches on this repository.

TL;DR: You need to edit this PR to be against master instead of nextercism

  • I renamed the old master to v2.x (I might just make this a tag, but for now it's a branch)
  • I pushed a copy of nextercism up to master

Once we've made sure everything looks right we can delete the nextercism branch.

@nywilken nywilken changed the base branch from nextercism to master July 14, 2018 10:01
This changes fixes the one test for Windows, but I am not entirely
confident that the test passing means that it will work 100% of the time
on Windows. I am still wrapping my head around how the submission stuff
should play out.
@nywilken nywilken force-pushed the windows-path-testing branch from 4ced209 to 4672b49 Compare July 14, 2018 10:13
@kytrinyx kytrinyx merged commit 78bdc08 into exercism:master Jul 14, 2018
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.

2 participants