Comments (4)
I stopped working on windows and now use Ubuntu... same code works without any problem in ubuntu!
from gotests.
For me it was the commented out import statement in test file. Removing it fixed the problem.
import (
// . "github.com/smartystreets/goconvey/convey"
)
from gotests.
Any updates on this issue?
from gotests.
This issue is still happening. I think I have found the cause:
On Windows, lines usually end with \r\n (CR, LF) unlike Unix's \n (LF).
In goparser.go:165, the start point of the code is set to furthestPos + 1
, where furthestPos is the End()
of the last ast.ImportSpec
in f.Imports
. The documentation says »position of first character immediately after the node«, which on Unix will be the subsequent \n
, but may be a \r
on Windows.
So in a Unix-encoded file, b[furthestPos + 1]
would be the closing brace after the imports block, as expected, but in a Windows-encoded file, b[furthestPos + 1]
will be the \n
after the \r
after the last import spec, and so the closing brace will be included in the returned slice.
The solution that seems most viable for me is checking for a CR-LF combination at b[furthestPos+1] and if one is encountered, increasing the counter once more. (Since files may have mixed encodings as well, and files on Windows can also be LF-encoded, especially if they are copied from Unix contexts, I wouldn't use any other heuristic.) I will send a pull request in a minute.
from gotests.
Related Issues (20)
- Setup GitHub actions for CI HOT 2
- Having tests as map vs slice HOT 8
- template_params argument HOT 4
- testify template results in wrong assert import depending on module cache HOT 1
- race condition in tests
- Cannot see any mock sample data when generating tests HOT 1
- Goland generate tests HOT 4
- where mock data? HOT 1
- Ability to exclude generated files
- Generic function support HOT 1
- Support only 2 latest major go releases
- Having a config file for each project
- How to generate named tests? HOT 7
- [bug] Some import path may be lost when receiver and methods are defined in different file
- not support generic
- Unable to Recursively Apply Generating to All Files in a Directory
- add custom template
- Tests generated with -parallel should use t.Parallel() at the top level of a Test function as well as in the subtest functions
- `go install github.com/cweill/[email protected]`: package github.com/cweill/gotests is not a main package HOT 3
- const vaues getting parsed
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gotests.