templete.go 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package main
  2. var (
  3. tpPackage = "package %s\n\n"
  4. tpImport = "import (\n\t%s\n)\n\n"
  5. tpVar = "var (\n\t%s\n\t\t)\n"
  6. tpInterface = "type %sInterface interface {\n%s}\n"
  7. tpIntfcFunc = "%s(%s) %s\n"
  8. tpMonkeyFunc = "// Mock%s .\nfunc Mock%s(%s %s,%s) (guard *monkey.PatchGuard) {\n\treturn monkey.PatchInstanceMethod(reflect.TypeOf(%s), \"%s\", func(_ %s, %s) (%s) {\n\t\treturn %s\n\t})\n}\n\n"
  9. tpTestReset = "\n\t\tconvCtx.Reset(func() {%s\n\t\t})"
  10. tpTestFunc = "func Test%s%s(t *testing.T){\n\tconvey.Convey(\"%s\", t, func(convCtx convey.C){\n\t\t%s\tconvCtx.Convey(\"When everything goes positive\", func(convCtx convey.C){\n\t\t\t%s\n\t\t\t})\n\t\t})%s\n\t})\n}\n\n"
  11. tpTestDaoMain = `func TestMain(m *testing.M) {
  12. if os.Getenv("DEPLOY_ENV") != "" {
  13. flag.Set("app_id", "")
  14. flag.Set("conf_token", "")
  15. flag.Set("tree_id", "")
  16. flag.Set("conf_version", "docker-1")
  17. flag.Set("deploy_env", "uat")
  18. flag.Set("conf_host", "config.bilibili.co")
  19. flag.Set("conf_path", "/tmp")
  20. flag.Set("region", "sh")
  21. flag.Set("zone", "sh001")
  22. }else{
  23. flag.Set("conf", "%s")
  24. }
  25. flag.Parse()
  26. if err := conf.Init(); err != nil {
  27. panic(err)
  28. }
  29. d = New(conf.Conf)
  30. os.Exit(m.Run())
  31. }
  32. `
  33. tpTestServiceMain = `func TestMain(m *testing.M){
  34. flag.Set("conf", "%s")
  35. flag.Parse()
  36. if err := conf.Init(); err != nil {
  37. panic(err)
  38. }
  39. s = New(conf.Conf)
  40. os.Exit(m.Run())
  41. }
  42. `
  43. moha = `Generation success!
  44. $$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$%.
  45. &$ &$ =$ $
  46. $ $$$$$$= @&
  47. B=$$ $$$$$$ $$&=
  48. $$$$ +1s $$&-$$ +1s $$$
  49. $$$$ $- $ $$$
  50. $ $ $ .B
  51. $ @ $ .=
  52. $ $ $ %
  53. $ =$ =$ @&
  54. #$$$$$$$$$% -@$$$$$$$$B
  55. 莫生 莫生
  56. 气 气
  57. 代码辣鸡非我意,
  58. 自己动手分田地;
  59. 你若气死谁如意?
  60. 谈笑风生活长命.
  61. // Release 1.1.3. Powered by 主站质保团队`
  62. )