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 bug #171: support command execute in linux or windows #180

Merged
merged 8 commits into from Feb 15, 2019

Conversation

Projects
None yet
2 participants
@ntwrick
Copy link
Contributor

commented Feb 12, 2019

Tested in linux and win10.

Thanks to @haifenghuang.

ntwrick added some commits Feb 12, 2019

@ntwrick

This comment has been minimized.

Copy link
Contributor Author

commented Feb 12, 2019

We have evaluator tests that run posix commands such as echo, et al. that do not work in windows.
Suppressing these in windows only for now. Need to find a way to run windows equivalent tests. Not sure what is the best way to do this.

Meanwhile, windows commands do work so we should merge this PR and make a new issue for tracking automated testing for windows.

@odino odino added this to the 1.2.x milestone Feb 13, 2019

@odino odino added the bug label Feb 13, 2019

@@ -508,7 +509,10 @@ b, c = [1, 2]; b`, 1},
a.int()
`, 10},
}

if runtime.GOOS == "windows" {

This comment has been minimized.

Copy link
@odino

odino Feb 13, 2019

Collaborator

I'd be worried not testing all of this stuff on windows. Maybe we can do the opposite -- check if we're not running on windows and push the test case inside the tests?

@@ -1022,7 +1026,10 @@ func TestBuiltinProperties(t *testing.T) {
{`{1: 1}.1`, "unusable as hash key: NUMBER"},
{`[].a`, "invalid property 'a' on type ARRAY"},
}

if runtime.GOOS == "windows" {

This comment has been minimized.

Copy link
@odino

odino Feb 13, 2019

Collaborator

same here

@@ -1101,7 +1108,10 @@ func TestCommand(t *testing.T) {
{"`echo hello world | xargs echo -n`", "hello world"},
{"`echo \\$CONTEXT`", "abs"},
}

if runtime.GOOS == "windows" {

This comment has been minimized.

Copy link
@odino

odino Feb 13, 2019

Collaborator

here it's different instead. Since the majority of these are unix commands I think it's ok to keep these out of the windows test suite for now, so 👍 I just have to remember that when we merge this I should open an issue to make sure we have tests for win commands as well

@ntwrick

This comment has been minimized.

Copy link
Contributor Author

commented Feb 13, 2019

@odino:

I created a window-specific commands test and removed bash-isms from other tests replacing them with builtins. Also, in windows REPL $(echo string) == "string\r", so the tests use this because you can't get rid of the CRLF from windows echo. Also, there is no equivalent of xargs in windows, so the pipe tests have been removed in windows.

However, in the travis windows build, the commands tests are failing with nothing but a ' ' to show for it. Any ideas?

@@ -1020,16 +1016,12 @@ func TestBuiltinProperties(t *testing.T) {
}{
{`"a".ok`, false},
{`"a".inv`, "invalid property 'inv' on type STRING"},
{"a = $(date);\na.ok", true},
{"a = cd();\na.ok", true},

This comment has been minimized.

Copy link
@odino

odino Feb 13, 2019

Collaborator

we should keep a test that checks for cmd.ok as cd is a special case on its own

@odino

This comment has been minimized.

Copy link
Collaborator

commented Feb 13, 2019

@ntwrick could this be of help? I remove extra newlines on linux, so it could be we should do the same on win as well?

@odino

This comment has been minimized.

Copy link
Collaborator

commented Feb 13, 2019

This is what happens when I remove the code for trimming altogether, should give you a bit more clarity:

https://travis-ci.com/abs-lang/abs/jobs/177535279

@odino

This comment has been minimized.

Copy link
Collaborator

commented Feb 13, 2019

@ntwrick BTW I'd like to reduce the scope of 1.2.0 to the current open PRs. Once they're reviewed and merged I think it's time for a release :) 1.2 will by then have:

  • win commands
  • background commands
  • fixes to .json
  • abs history

It would be great if we could also include the include(file) stuff you've been working on -- up to you if you're ready to finalize that branch as well.

@ntwrick

This comment has been minimized.

Copy link
Contributor Author

commented Feb 13, 2019

Using strings.TrimSpace() at return from eval command. This works in both linux and windows. Removed \r in windows command tests. Also removed $(echo \$CONTEXT) as OS env $VARs are not defined in windows.

@ntwrick

This comment has been minimized.

Copy link
Contributor Author

commented Feb 13, 2019

@odino: Working on your suggestions to #163 in branch absrc-source-file. Nearly complete but may need another day to finish.

@odino

This comment has been minimized.

Copy link
Collaborator

commented Feb 13, 2019

@odino

This comment has been minimized.

Copy link
Collaborator

commented Feb 13, 2019

@odino

odino approved these changes Feb 15, 2019

@odino odino merged commit e86b550 into 1.2.x Feb 15, 2019

1 check passed

coverage/coveralls Coverage increased (+0.004%) to 73.342%
Details

@ntwrick ntwrick deleted the issue-171 branch Feb 21, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.