-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #38 from xushiwei/test
yaptest: RunMock/RunTestServer; demo/basic
- Loading branch information
Showing
12 changed files
with
149 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
github.com/qiniu/x v1.13.2 h1:mgWOfB9Rpk6AEtlBoObZVxH+b2FHSntYrxc4KX5Ta98= | ||
github.com/qiniu/x v1.13.2/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E= | ||
github.com/qiniu/x v1.13.3-0.20240129201727-4013f184c5c7 h1:rzpGloMVgWexXti9yRXMH8aAdjNy8rZrlAQdKvzZeMg= | ||
github.com/qiniu/x v1.13.3-0.20240129201727-4013f184c5c7/go.mod h1:INZ2TSWSJVWO/RuELQROERcslBwVgFG7MkTfEdaQz9E= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import "github.com/goplus/yap" | ||
|
||
var ( | ||
yap.App | ||
) | ||
|
||
initYap | ||
|
||
get "/p/:id", ctx => { | ||
ctx.json { | ||
"id": ctx.param("id"), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
server := new(foo) | ||
server.main | ||
runMock "foo.com", server | ||
|
||
run "get /p/$id", => { | ||
id := "123" | ||
get "http://foo.com/p/${id}" | ||
ret 200 | ||
json { | ||
"id": "12", | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package main | ||
|
||
import "github.com/goplus/yap" | ||
|
||
const _ = true | ||
|
||
type foo struct { | ||
yap.App | ||
} | ||
//line ytest/demo/basic/foo.gox:7 | ||
func (this *foo) Main() { | ||
//line ytest/demo/basic/foo.gox:7:1 | ||
this.InitYap() | ||
//line ytest/demo/basic/foo.gox:9:1 | ||
this.Get("/p/:id", func(ctx *yap.Context) { | ||
//line ytest/demo/basic/foo.gox:10:1 | ||
ctx.Json__1(map[string]string{"id": ctx.Param("id")}) | ||
}) | ||
} | ||
func main() { | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package main | ||
|
||
import ( | ||
"github.com/goplus/yap/ytest" | ||
"testing" | ||
) | ||
|
||
type case_foo struct { | ||
ytest.Case | ||
} | ||
//line ytest/demo/basic/foo_ytest.gox:1 | ||
func (this *case_foo) Main() { | ||
//line ytest/demo/basic/foo_ytest.gox:1:1 | ||
server := new(foo) | ||
//line ytest/demo/basic/foo_ytest.gox:2:1 | ||
server.Main() | ||
//line ytest/demo/basic/foo_ytest.gox:3:1 | ||
this.RunMock("foo.com", server) | ||
//line ytest/demo/basic/foo_ytest.gox:5:1 | ||
this.Run("get /p/$id", func() { | ||
//line ytest/demo/basic/foo_ytest.gox:6:1 | ||
id := "123" | ||
//line ytest/demo/basic/foo_ytest.gox:7:1 | ||
this.Get("http://foo.com/p/" + id) | ||
//line ytest/demo/basic/foo_ytest.gox:8:1 | ||
this.RetWith(200) | ||
//line ytest/demo/basic/foo_ytest.gox:9:1 | ||
this.Json(map[string]string{"id": "12"}) | ||
}) | ||
} | ||
func Test_foo(t *testing.T) { | ||
ytest.Gopt_Case_TestMain(new(case_foo), t) | ||
} |
This file was deleted.
Oops, something went wrong.