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

Implement #602 and fix simple server #604

Merged
merged 4 commits into from
Feb 27, 2018
Merged

Implement #602 and fix simple server #604

merged 4 commits into from
Feb 27, 2018

Conversation

st0012
Copy link
Member

@st0012 st0012 commented Feb 25, 2018

Previously because of implementing break I broke our nested block execution, which caused simple server's block argument unable to function normally. So this PR is to add integration test for simple server and fix the issue.

@codecov
Copy link

codecov bot commented Feb 25, 2018

Codecov Report

Merging #604 into master will increase coverage by 0.41%.
The diff coverage is 73.33%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #604      +/-   ##
==========================================
+ Coverage   82.33%   82.75%   +0.41%     
==========================================
  Files          55       55              
  Lines        7231     7238       +7     
==========================================
+ Hits         5954     5990      +36     
+ Misses       1034     1001      -33     
- Partials      243      247       +4
Impacted Files Coverage Δ
vm/instruction.go 93.27% <100%> (+0.02%) ⬆️
vm/call_frame.go 88.49% <100%> (ø) ⬆️
vm/simple_server.go 68.46% <50%> (+24.91%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4126ab0...3bb3e9b. Read the comment docs.

v.testEval(t, tt.input, getFilename())
}()

time.Sleep(1 * time.Second)
Copy link
Contributor

@ear7h ear7h Feb 25, 2018

Choose a reason for hiding this comment

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

This is my only concern. Would calling server.start from a thread cause execution to end in the test VM? If not, you could use a mutex.

Copy link
Member Author

Choose a reason for hiding this comment

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

What do you mean? It'll make the vm inside goroutine to run the server (and hang there). This sleep is just to make sure we don't make the request before the server is started

Copy link
Contributor

Choose a reason for hiding this comment

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

I metioned the wrong syncing mechanism, meant a wait group. I just think we shouldn't rely on time.sleep for thread safety. I was curious if the following snippets would work:

thread do
   server.start
end

the tests function

waitgroup.Add(1)
go func() {
    ...
    v.testEval(...) // does the vm die after this statement? or will the server still be running?
    waitgroup.Done()
}

waitgroup.Wait()
// run the tests

Copy link
Member Author

Choose a reason for hiding this comment

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

@ear7h The problem is that since we're running a web server in testEval, so it won't actually end and call waitgroup.Done()

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah okay, I wasn't sure of the mechanics of the test vm

Copy link
Contributor

@ear7h ear7h left a comment

Choose a reason for hiding this comment

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

Just formatting

@@ -10,10 +10,10 @@ import (
"path/filepath"
"unicode"

"fmt"
Copy link
Contributor

@ear7h ear7h Feb 25, 2018

Choose a reason for hiding this comment

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

I think this should be with the group above

"github.com/fatih/structs"
"github.com/goby-lang/goby/vm/classes"
"github.com/gorilla/mux"
"fmt"
"strconv"
Copy link
Contributor

Choose a reason for hiding this comment

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

also grouped with the std lib

Copy link
Member Author

Choose a reason for hiding this comment

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

@ear7h I already ran gofmt and I want to follow what it changes/allows

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, but I believe gofmt preserves newlines so the two groups of imports are formatted independently of each other.

Copy link
Member Author

Choose a reason for hiding this comment

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

If you insist I can change this time, but I don't see the point to group them all manually in every future PRs

Copy link
Contributor

Choose a reason for hiding this comment

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

Alright, makes sense

@st0012 st0012 merged commit 942c503 into master Feb 27, 2018
@ghost ghost removed the in progress label Feb 27, 2018
@st0012 st0012 deleted the implement-#602 branch February 27, 2018 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants