diff --git a/cls_stub_gen/stub_gen.go b/cls_stub_gen/stub_gen.go index d581bf3..5e49bda 100644 --- a/cls_stub_gen/stub_gen.go +++ b/cls_stub_gen/stub_gen.go @@ -41,7 +41,7 @@ type StubGenConfig struct { AllowFileCreation bool //当目标文件不存在时,能否能新建文件,假如设置为不能,就必须得找到文件才能写内容 } -func GenerateStubsFile(config *StubGenConfig, stubParams ...*StubParam) { +func GenerateStubs(config *StubGenConfig, stubParams ...*StubParam) { utils.PrintObject(config) must.Nice(config.SourceRootPath) diff --git a/internal/examples/example_cls_stub_gen/example0/example0node/example0node.go b/internal/examples/example_cls_stub_gen/example0/example0.go similarity index 79% rename from internal/examples/example_cls_stub_gen/example0/example0node/example0node.go rename to internal/examples/example_cls_stub_gen/example0/example0.go index af6f220..c447b75 100644 --- a/internal/examples/example_cls_stub_gen/example0/example0node/example0node.go +++ b/internal/examples/example_cls_stub_gen/example0/example0.go @@ -1,6 +1,7 @@ -package example0node +package example0 -var NODE = &A{} +var STUB1 = &A{} +var STUB2 = &A{} type A struct{} diff --git a/internal/examples/example_cls_stub_gen/example0/example0x1gen/gen.go b/internal/examples/example_cls_stub_gen/example0/example0x1gen/gen.go new file mode 100644 index 0000000..19bb2db --- /dev/null +++ b/internal/examples/example_cls_stub_gen/example0/example0x1gen/gen.go @@ -0,0 +1,16 @@ +package example0x1gen + +import "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example0" + +func Get() *example0.A { + return example0.STUB1.Get() +} +func Set(arg string) { + example0.STUB1.Set(arg) +} +func Add(x int, y int) int { + return example0.STUB1.Add(x, y) +} +func Sub(x int, y int) (int, error) { + return example0.STUB1.Sub(x, y) +} diff --git a/internal/examples/example_cls_stub_gen/example0/gen_test.go b/internal/examples/example_cls_stub_gen/example0/example0x1gen/gen_test.go similarity index 70% rename from internal/examples/example_cls_stub_gen/example0/gen_test.go rename to internal/examples/example_cls_stub_gen/example0/example0x1gen/gen_test.go index 6c6f09a..64d1a89 100644 --- a/internal/examples/example_cls_stub_gen/example0/gen_test.go +++ b/internal/examples/example_cls_stub_gen/example0/example0x1gen/gen_test.go @@ -1,4 +1,4 @@ -package example0 +package example0x1gen import ( "testing" @@ -6,20 +6,20 @@ import ( "github.com/yyle88/runpath" "github.com/yyle88/runpath/runtestpath" "github.com/yyle88/sure/cls_stub_gen" - "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example0/example0node" + "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example0" "github.com/yyle88/syntaxgo" "github.com/yyle88/syntaxgo/syntaxgo_ast" ) func TestGen(t *testing.T) { - param := cls_stub_gen.NewStubParam(&example0node.A{}, "example0node.NODE") + param := cls_stub_gen.NewStubParam(&example0.A{}, "example0.STUB1") cfg := &cls_stub_gen.StubGenConfig{ - SourceRootPath: runpath.PARENT.Join("example0node"), + SourceRootPath: runpath.PARENT.Join("../../example0"), TargetPackageName: syntaxgo.CurrentPackageName(), ImportOptions: syntaxgo_ast.NewPackageImportOptions(), OutputPath: runtestpath.SrcPath(t), AllowFileCreation: false, } - cls_stub_gen.GenerateStubsFile(cfg, param) + cls_stub_gen.GenerateStubs(cfg, param) } diff --git a/internal/examples/example_cls_stub_gen/example0/example0x2gen/gen.go b/internal/examples/example_cls_stub_gen/example0/example0x2gen/gen.go new file mode 100644 index 0000000..f3bf341 --- /dev/null +++ b/internal/examples/example_cls_stub_gen/example0/example0x2gen/gen.go @@ -0,0 +1,16 @@ +package example0x2gen + +import "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example0" + +func Get() *example0.A { + return example0.STUB2.Get() +} +func Set(arg string) { + example0.STUB2.Set(arg) +} +func Add(x int, y int) int { + return example0.STUB2.Add(x, y) +} +func Sub(x int, y int) (int, error) { + return example0.STUB2.Sub(x, y) +} diff --git a/internal/examples/example_cls_stub_gen/example0/example0x2gen/gen_test.go b/internal/examples/example_cls_stub_gen/example0/example0x2gen/gen_test.go new file mode 100644 index 0000000..f4a1f41 --- /dev/null +++ b/internal/examples/example_cls_stub_gen/example0/example0x2gen/gen_test.go @@ -0,0 +1,25 @@ +package example0x2gen + +import ( + "testing" + + "github.com/yyle88/runpath" + "github.com/yyle88/runpath/runtestpath" + "github.com/yyle88/sure/cls_stub_gen" + "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example0" + "github.com/yyle88/syntaxgo" + "github.com/yyle88/syntaxgo/syntaxgo_ast" +) + +func TestGen(t *testing.T) { + param := cls_stub_gen.NewStubParam(&example0.A{}, "example0.STUB2") + + cfg := &cls_stub_gen.StubGenConfig{ + SourceRootPath: runpath.PARENT.Join("../../example0"), + TargetPackageName: syntaxgo.CurrentPackageName(), + ImportOptions: syntaxgo_ast.NewPackageImportOptions(), + OutputPath: runtestpath.SrcPath(t), + AllowFileCreation: false, + } + cls_stub_gen.GenerateStubs(cfg, param) +} diff --git a/internal/examples/example_cls_stub_gen/example0/gen.go b/internal/examples/example_cls_stub_gen/example0/gen.go deleted file mode 100644 index f487af5..0000000 --- a/internal/examples/example_cls_stub_gen/example0/gen.go +++ /dev/null @@ -1,16 +0,0 @@ -package example0 - -import "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example0/example0node" - -func Get() *example0node.A { - return example0node.NODE.Get() -} -func Set(arg string) { - example0node.NODE.Set(arg) -} -func Add(x int, y int) int { - return example0node.NODE.Add(x, y) -} -func Sub(x int, y int) (int, error) { - return example0node.NODE.Sub(x, y) -} diff --git a/internal/examples/example_cls_stub_gen/example6/example6.go b/internal/examples/example_cls_stub_gen/example6/example6.go new file mode 100644 index 0000000..ac07d57 --- /dev/null +++ b/internal/examples/example_cls_stub_gen/example6/example6.go @@ -0,0 +1,13 @@ +package example6 + +type A struct { + name string +} + +func NewA(name string) *A { + return &A{name: name} +} + +func (a *A) Name() string { + return a.name +} diff --git a/internal/examples/example_cls_stub_gen/example6/example6x1gen/gen.go b/internal/examples/example_cls_stub_gen/example6/example6x1gen/gen.go new file mode 100644 index 0000000..9f40814 --- /dev/null +++ b/internal/examples/example_cls_stub_gen/example6/example6x1gen/gen.go @@ -0,0 +1,5 @@ +package example6x1gen + +func Name() string { + return A100.Name() +} diff --git a/internal/examples/example_cls_stub_gen/example6/example6x1gen/gen_test.go b/internal/examples/example_cls_stub_gen/example6/example6x1gen/gen_test.go new file mode 100644 index 0000000..36a25db --- /dev/null +++ b/internal/examples/example_cls_stub_gen/example6/example6x1gen/gen_test.go @@ -0,0 +1,25 @@ +package example6x1gen + +import ( + "testing" + + "github.com/yyle88/runpath" + "github.com/yyle88/runpath/runtestpath" + "github.com/yyle88/sure/cls_stub_gen" + "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example6" + "github.com/yyle88/syntaxgo" + "github.com/yyle88/syntaxgo/syntaxgo_ast" +) + +func TestGen(t *testing.T) { + param := cls_stub_gen.NewStubParam(&example6.A{}, "A100") + + cfg := &cls_stub_gen.StubGenConfig{ + SourceRootPath: runpath.PARENT.Join("../../example6"), + TargetPackageName: syntaxgo.CurrentPackageName(), + ImportOptions: syntaxgo_ast.NewPackageImportOptions(), + OutputPath: runtestpath.SrcPath(t), + AllowFileCreation: false, + } + cls_stub_gen.GenerateStubs(cfg, param) +} diff --git a/internal/examples/example_cls_stub_gen/example6/example6x1gen/singleton.go b/internal/examples/example_cls_stub_gen/example6/example6x1gen/singleton.go new file mode 100644 index 0000000..9d428d1 --- /dev/null +++ b/internal/examples/example_cls_stub_gen/example6/example6x1gen/singleton.go @@ -0,0 +1,5 @@ +package example6x1gen + +import "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example6" + +var A100 = example6.NewA("100") diff --git a/internal/examples/example_cls_stub_gen/example6/example6x2gen/gen.go b/internal/examples/example_cls_stub_gen/example6/example6x2gen/gen.go new file mode 100644 index 0000000..3b79f58 --- /dev/null +++ b/internal/examples/example_cls_stub_gen/example6/example6x2gen/gen.go @@ -0,0 +1,5 @@ +package example6x2gen + +func Name() string { + return A200.Name() +} diff --git a/internal/examples/example_cls_stub_gen/example6/example6x2gen/gen_test.go b/internal/examples/example_cls_stub_gen/example6/example6x2gen/gen_test.go new file mode 100644 index 0000000..f46caa7 --- /dev/null +++ b/internal/examples/example_cls_stub_gen/example6/example6x2gen/gen_test.go @@ -0,0 +1,25 @@ +package example6x2gen + +import ( + "testing" + + "github.com/yyle88/runpath" + "github.com/yyle88/runpath/runtestpath" + "github.com/yyle88/sure/cls_stub_gen" + "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example6" + "github.com/yyle88/syntaxgo" + "github.com/yyle88/syntaxgo/syntaxgo_ast" +) + +func TestGen(t *testing.T) { + param := cls_stub_gen.NewStubParam(&example6.A{}, "A200") + + cfg := &cls_stub_gen.StubGenConfig{ + SourceRootPath: runpath.PARENT.Join("../../example6"), + TargetPackageName: syntaxgo.CurrentPackageName(), + ImportOptions: syntaxgo_ast.NewPackageImportOptions(), + OutputPath: runtestpath.SrcPath(t), + AllowFileCreation: false, + } + cls_stub_gen.GenerateStubs(cfg, param) +} diff --git a/internal/examples/example_cls_stub_gen/example6/example6x2gen/singleton.go b/internal/examples/example_cls_stub_gen/example6/example6x2gen/singleton.go new file mode 100644 index 0000000..36b7b43 --- /dev/null +++ b/internal/examples/example_cls_stub_gen/example6/example6x2gen/singleton.go @@ -0,0 +1,5 @@ +package example6x2gen + +import "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example6" + +var A200 = example6.NewA("200") diff --git a/internal/examples/example_cls_stub_gen/examples.go b/internal/examples/example_cls_stub_gen/examples.go new file mode 100644 index 0000000..00082e8 --- /dev/null +++ b/internal/examples/example_cls_stub_gen/examples.go @@ -0,0 +1,26 @@ +package example_cls_stub_gen + +import ( + "math/rand/v2" + + "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example0/example0x1gen" + "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example0/example0x2gen" + "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example6/example6x1gen" + "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example6/example6x2gen" +) + +func Example0x1() int { + return example0x1gen.Add(rand.IntN(100), rand.IntN(100)) +} + +func Example0x2() int { + return example0x2gen.Add(rand.IntN(100), rand.IntN(100)) +} + +func Example6x1() string { + return example6x1gen.Name() +} + +func Example6x2() string { + return example6x2gen.Name() +} diff --git a/internal/examples/example_cls_stub_gen/examples_test.go b/internal/examples/example_cls_stub_gen/examples_test.go new file mode 100644 index 0000000..3cb3155 --- /dev/null +++ b/internal/examples/example_cls_stub_gen/examples_test.go @@ -0,0 +1,23 @@ +package example_cls_stub_gen + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestExample0x1(t *testing.T) { + t.Log(Example0x1()) +} + +func TestExample0x2(t *testing.T) { + t.Log(Example0x2()) +} + +func TestExample6x1(t *testing.T) { + require.Equal(t, "100", Example6x1()) +} + +func TestExample6x2(t *testing.T) { + require.Equal(t, "200", Example6x2()) +} diff --git a/internal/examples/example_sure_cls_gen/example5/example5surenode/example5mustsoftnode.go b/internal/examples/example_sure_cls_gen/example5/example5sure_custom/example5sure_custom.go similarity index 68% rename from internal/examples/example_sure_cls_gen/example5/example5surenode/example5mustsoftnode.go rename to internal/examples/example_sure_cls_gen/example5/example5sure_custom/example5sure_custom.go index 9d7279a..9134991 100644 --- a/internal/examples/example_sure_cls_gen/example5/example5surenode/example5mustsoftnode.go +++ b/internal/examples/example_sure_cls_gen/example5/example5sure_custom/example5sure_custom.go @@ -1,23 +1,23 @@ -package example5surenode +package example5sure_custom import ( "github.com/yyle88/zaplog" "go.uber.org/zap" ) -var NODE = &Node{} +var NODE = &SureClass{} -type Node struct{} +type SureClass struct{} // Must 硬硬的,当有err时直接panic崩溃掉,流程中止 -func (node *Node) Must(err error) { +func (node *SureClass) Must(err error) { if err != nil { zaplog.LOGS.P1.Panic("must", zap.Error(err)) } } // Soft 软软的,当有err时只打印个告警日志,流程继续 -func (node *Node) Soft(err error) { +func (node *SureClass) Soft(err error) { if err != nil { zaplog.LOGS.P1.Warn("soft", zap.Error(err)) } diff --git a/internal/examples/example_sure_cls_gen/example5/example5sure_custom/example5sure_custom_test.go b/internal/examples/example_sure_cls_gen/example5/example5sure_custom/example5sure_custom_test.go new file mode 100644 index 0000000..dd44e97 --- /dev/null +++ b/internal/examples/example_sure_cls_gen/example5/example5sure_custom/example5sure_custom_test.go @@ -0,0 +1,25 @@ +package example5sure_custom + +import ( + "testing" + + "github.com/pkg/errors" +) + +func TestNode_Must(t *testing.T) { + run := func() (string, error) { + return "OK", nil + } + res, err := run() + NODE.Must(err) + t.Log(res) +} + +func TestNode_Soft(t *testing.T) { + run := func() (string, error) { + return "", errors.New("wrong") + } + res, err := run() + NODE.Soft(err) + t.Log(res) +} diff --git a/internal/examples/example_sure_cls_gen/example5/gen.go b/internal/examples/example_sure_cls_gen/example5/gen.go index e71c995..6d3b8f4 100644 --- a/internal/examples/example_sure_cls_gen/example5/gen.go +++ b/internal/examples/example_sure_cls_gen/example5/gen.go @@ -1,6 +1,6 @@ package example5 -import "github.com/yyle88/sure/internal/examples/example_sure_cls_gen/example5/example5surenode" +import "github.com/yyle88/sure/internal/examples/example_sure_cls_gen/example5/example5sure_custom" type ExampleMust struct{ a *Example } @@ -9,12 +9,12 @@ func (a *Example) Must() *ExampleMust { } func (T *ExampleMust) GetN() (res int) { res, err1 := T.a.GetN() - example5surenode.NODE.Must(err1) + example5sure_custom.NODE.Must(err1) return res } func (T *ExampleMust) GetS() (res string) { res, err1 := T.a.GetS() - example5surenode.NODE.Must(err1) + example5sure_custom.NODE.Must(err1) return res } @@ -25,12 +25,12 @@ func (a *Example) Soft() *ExampleSoft { } func (T *ExampleSoft) GetN() (res int) { res, err1 := T.a.GetN() - example5surenode.NODE.Soft(err1) + example5sure_custom.NODE.Soft(err1) return res } func (T *ExampleSoft) GetS() (res string) { res, err1 := T.a.GetS() - example5surenode.NODE.Soft(err1) + example5sure_custom.NODE.Soft(err1) return res } @@ -41,12 +41,12 @@ func (a *Demo) Must() *DemoMust { } func (T *DemoMust) GetN() (res int) { res, err1 := T.a.GetN() - example5surenode.NODE.Must(err1) + example5sure_custom.NODE.Must(err1) return res } func (T *DemoMust) GetS() (res string) { res, err1 := T.a.GetS() - example5surenode.NODE.Must(err1) + example5sure_custom.NODE.Must(err1) return res } @@ -57,11 +57,11 @@ func (a *Demo) Soft() *DemoSoft { } func (T *DemoSoft) GetN() (res int) { res, err1 := T.a.GetN() - example5surenode.NODE.Soft(err1) + example5sure_custom.NODE.Soft(err1) return res } func (T *DemoSoft) GetS() (res string) { res, err1 := T.a.GetS() - example5surenode.NODE.Soft(err1) + example5sure_custom.NODE.Soft(err1) return res } diff --git a/internal/examples/example_sure_cls_gen/example5/gen_test.go b/internal/examples/example_sure_cls_gen/example5/gen_test.go index 1b7244a..22e8da1 100644 --- a/internal/examples/example_sure_cls_gen/example5/gen_test.go +++ b/internal/examples/example_sure_cls_gen/example5/gen_test.go @@ -5,7 +5,7 @@ import ( "github.com/yyle88/runpath" "github.com/yyle88/runpath/runtestpath" - "github.com/yyle88/sure/internal/examples/example_sure_cls_gen/example5/example5surenode" + "github.com/yyle88/sure/internal/examples/example_sure_cls_gen/example5/example5sure_custom" "github.com/yyle88/sure/sure_cls_gen" "github.com/yyle88/syntaxgo" "github.com/yyle88/syntaxgo/syntaxgo_ast" @@ -14,10 +14,10 @@ import ( func TestGen(t *testing.T) { cfg := &sure_cls_gen.ClassGenConfig{ ClassGenOptions: sure_cls_gen.NewClassGenOptions(runpath.PARENT.Path()). - WithErrorHandlerFuncName("example5surenode.NODE"), + WithErrorHandlerFuncName("example5sure_custom.NODE"), PackageName: syntaxgo.CurrentPackageName(), ImportOptions: syntaxgo_ast.NewPackageImportOptions(). - SetInferredObject(example5surenode.Node{}), + SetInferredObject(example5sure_custom.SureClass{}), OutputPath: runtestpath.SrcPath(t), } sure_cls_gen.GenerateClasses(cfg, Example{}, Demo{}) diff --git a/internal/examples/example_sure_cls_gen/examples.go b/internal/examples/example_sure_cls_gen/examples.go new file mode 100644 index 0000000..26cc96c --- /dev/null +++ b/internal/examples/example_sure_cls_gen/examples.go @@ -0,0 +1 @@ +package example_sure_cls_gen diff --git a/internal/examples/example_sure_cls_gen/examples_test.go b/internal/examples/example_sure_cls_gen/examples_test.go new file mode 100644 index 0000000..b6d4a8c --- /dev/null +++ b/internal/examples/example_sure_cls_gen/examples_test.go @@ -0,0 +1,65 @@ +package example_sure_cls_gen + +import ( + "testing" + + "github.com/yyle88/sure/internal/examples/example_sure_cls_gen/example1" + "github.com/yyle88/sure/internal/examples/example_sure_cls_gen/example4" + "github.com/yyle88/sure/internal/examples/example_sure_cls_gen/example5" +) + +func TestExample1(t *testing.T) { + //当你要操作的是个对象时,你就可以赋予这个对象 Must 和 Soft 的能力,Must表示出错时崩溃,而Soft表示出错是仅仅告警但流程继续 + a := example1.NewExample(1, "s") + t.Log(a.Must().GetN()) + t.Log(a.Must().GetS()) + + t.Log(a.Soft().GetN()) + t.Log(a.Soft().GetS()) +} + +func TestExample4(t *testing.T) { + //当你要操作的是个对象时,你就可以赋予这个对象 Must 和 Soft 的能力,Must表示出错时崩溃,而Soft表示出错是仅仅告警但流程继续 + a := example4.NewExample(1, "s") + ma := a.Must() + sa := a.Soft() + + t.Log(ma.GetN()) + t.Log(ma.GetS()) + + t.Log(sa.GetN()) + t.Log(sa.GetS()) + + b := example4.NewExample(1, "s") + mb := b.Must() + sb := b.Soft() + + t.Log(mb.GetN()) + t.Log(mb.GetS()) + + t.Log(sb.GetN()) + t.Log(sb.GetS()) +} + +func TestExample5(t *testing.T) { + //当你要操作的是个对象时,你就可以赋予这个对象 Must 和 Soft 的能力,Must表示出错时崩溃,而Soft表示出错是仅仅告警但流程继续 + a := example5.NewExample(1, "s") + ma := a.Must() + sa := a.Soft() + + t.Log(ma.GetN()) + t.Log(ma.GetS()) + + t.Log(sa.GetN()) + t.Log(sa.GetS()) + + b := example5.NewExample(1, "s") + mb := b.Must() + sb := b.Soft() + + t.Log(mb.GetN()) + t.Log(mb.GetS()) + + t.Log(sb.GetN()) + t.Log(sb.GetS()) +} diff --git a/internal/examples/example_sure_pkg_gen/examples.go b/internal/examples/example_sure_pkg_gen/examples.go new file mode 100644 index 0000000..55c5ebb --- /dev/null +++ b/internal/examples/example_sure_pkg_gen/examples.go @@ -0,0 +1 @@ +package example_sure_pkg_gen diff --git a/internal/examples/examples_test.go b/internal/examples/example_sure_pkg_gen/examples_test.go similarity index 61% rename from internal/examples/examples_test.go rename to internal/examples/example_sure_pkg_gen/examples_test.go index 41e1131..e0ce5e6 100644 --- a/internal/examples/examples_test.go +++ b/internal/examples/example_sure_pkg_gen/examples_test.go @@ -1,32 +1,15 @@ -package examples +package example_sure_pkg_gen import ( "testing" "github.com/stretchr/testify/require" - "github.com/yyle88/sure/internal/examples/example_sure_cls_gen/example1" - "github.com/yyle88/sure/internal/examples/example_sure_cls_gen/example4" "github.com/yyle88/sure/internal/examples/example_sure_pkg_gen/example2/example2_must" "github.com/yyle88/sure/internal/examples/example_sure_pkg_gen/example2/example2_soft" "github.com/yyle88/sure/internal/examples/example_sure_pkg_gen/example3/example3_must" "github.com/yyle88/sure/internal/examples/example_sure_pkg_gen/example3/example3_soft" ) -func TestExample0(t *testing.T) { - res := Example0() - t.Log(res) -} - -func TestExample1(t *testing.T) { - //当你要操作的是个对象时,你就可以赋予这个对象 Must 和 Soft 的能力,Must表示出错时崩溃,而Soft表示出错是仅仅告警但流程继续 - a := example1.NewExample(1, "s") - t.Log(a.Must().GetN()) - t.Log(a.Must().GetS()) - - t.Log(a.Soft().GetN()) - t.Log(a.Soft().GetS()) -} - func TestExample2(t *testing.T) { //但是假如你要操作的是个包,你就可以在这个包的基础上衍生出 must 包 和 soft 包,能让你在调用时避免判断错误 t.Log(example2_must.GetN()) @@ -60,26 +43,3 @@ func TestExample3(t *testing.T) { require.Equal(t, "haha", resX.Name) } } - -func TestExample4(t *testing.T) { - //当你要操作的是个对象时,你就可以赋予这个对象 Must 和 Soft 的能力,Must表示出错时崩溃,而Soft表示出错是仅仅告警但流程继续 - a := example4.NewExample(1, "s") - ma := a.Must() - sa := a.Soft() - - t.Log(ma.GetN()) - t.Log(ma.GetS()) - - t.Log(sa.GetN()) - t.Log(sa.GetS()) - - b := example4.NewExample(1, "s") - mb := b.Must() - sb := b.Soft() - - t.Log(mb.GetN()) - t.Log(mb.GetS()) - - t.Log(sb.GetN()) - t.Log(sb.GetS()) -} diff --git a/internal/examples/examples.go b/internal/examples/examples.go deleted file mode 100644 index fd04641..0000000 --- a/internal/examples/examples.go +++ /dev/null @@ -1,11 +0,0 @@ -package examples - -import ( - "math/rand/v2" - - "github.com/yyle88/sure/internal/examples/example_cls_stub_gen/example0" -) - -func Example0() int { - return example0.Add(rand.IntN(100), rand.IntN(100)) -}