MCPcopy
hub / github.com/uber-go/fx / TestWindowsMinimalApp

Function TestWindowsMinimalApp

app_windows_test.go:96–122  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

94}
95
96func TestWindowsMinimalApp(t *testing.T) {
97 // This is not a real test.
98 // It defines the behavior of the fake application
99 // that we spawn from TestWindowsCtrlCHandler.
100 if os.Getenv("FX_TEST_FAKE") != "1" {
101 return
102 }
103
104 // An Fx application that prints "ready" to stderr
105 // once its start hooks have been invoked,
106 // and "ONSTOP" to stdout when its stop hooks have been invoked.
107 fx.New(
108 fx.NopLogger,
109 fx.Invoke(func(lifecycle fx.Lifecycle) {
110 lifecycle.Append(fx.Hook{
111 OnStart: func(ctx context.Context) error {
112 fmt.Fprintln(os.Stderr, "ready")
113 return nil
114 },
115 OnStop: func(ctx context.Context) error {
116 fmt.Fprintln(os.Stdout, "ONSTOP")
117 return nil
118 },
119 })
120 }),
121 ).Run()
122}

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
InvokeFunction · 0.92
RunMethod · 0.80
AppendMethod · 0.65

Tested by

no test coverage detected