Comments (2)
ref to: #61
Should use either GO_FAILPOINTS="mypackagename/demoPanic=return(\"100\")"
or GO_FAILPOINTS='mypackagename/demoPanic=return("100")'
from failpoint.
// add.go
func add(ctx context.Context) string {
failpoint.InjectContext(ctx, "failpoint-name1", func(value failpoint.Value) string {
failpoint.Return(value.(string))
})
return "1"
}
// add_test.go
func TestAdd(t *testing.T) {
err := failpoint.Enable("golangtest/gofailpoint/failpoint-name1", "return('0.01')")
if err != nil {
log.Fatal(err)
}
failpoints := map[string]struct{}{
"golangtest/gofailpoint/failpoint-name1": {},
}
ctx := failpoint.WithHook(context.Background(), func(ctx context.Context, fpname string) bool {
_, found := failpoints[fpname]
return found
})
log.Println(add(ctx))
}
when I execute my program, it truns out that:
error on golangtest/gofailpoint/failpoint-name1: failpoint: failed to parse "return('0.01')" past ")"
how come does not it support "return('0.01')"
of this pattern?
from failpoint.
Related Issues (18)
- Is there any demo or userguide for failpoint? HOT 7
- go test failed HOT 8
- failpoint doesn't work if the marker function is defined in the main package HOT 7
- failpoint can not use a constant-string as marker function name HOT 4
- Add a "DO NOT EDIT" comment to failpoint-enabled source code HOT 2
- failpoint not activated HOT 2
- failpoint in anonymous function can not be enable
- type assert OK print error message
- Create Release Binary amd and Darwin HOT 2
- Register an action func to be called when a failpoint is evaluated
- Why do we call `fmt.Println` in `failpoints.Eval` HOT 1
- How to inject faults to a program at running time with failpoint HOT 2
- Failpoint doesn't work when Inject function defined in a closure argument
- failpoint can be actived if it is injected with in a function clusure HOT 1
- failpoint.Disable should be idempotent HOT 1
- Failpoints are getting executed while running tests using `go test -v`
- Failpoints.Disable not remove failpath from fps.reg HOT 1
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 failpoint.