diff --git a/vlib/vweb/vweb_app_test.v b/vlib/vweb/vweb_app_test.v index 7c5553552c..d5bdb6e2a4 100644 --- a/vlib/vweb/vweb_app_test.v +++ b/vlib/vweb/vweb_app_test.v @@ -18,13 +18,13 @@ struct Article { } fn test_a_vweb_application_compiles() { - spawn fn () { - time.sleep(2 * time.second) - exit(0) - }() vweb.run(&App{}, 18081) } +pub fn (mut app App) before_accept_loop() { + exit(0) +} + pub fn (mut app App) before_request() { app.user_id = app.get_cookie('id') or { '0' } } @@ -49,18 +49,18 @@ pub fn (mut app App) new_article() vweb.Result { return app.redirect('/') } -fn (mut app App) time() { - app.text(time.now().format()) +fn (mut app App) time() vweb.Result { + return app.text(time.now().format()) } -fn (mut app App) time_json() { - app.json({ +fn (mut app App) time_json() vweb.Result { + return app.json({ 'time': time.now().format() }) } -fn (mut app App) time_json_pretty() { - app.json_pretty({ +fn (mut app App) time_json_pretty() vweb.Result { + return app.json_pretty({ 'time': time.now().format() }) }