vweb: fix routes without results in vweb_app_test.v (#20548)

This commit is contained in:
Hitalo Souza 2024-01-15 16:00:07 -04:00 committed by GitHub
parent 508117d62f
commit 3b19864aa3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -18,13 +18,13 @@ struct Article {
} }
fn test_a_vweb_application_compiles() { fn test_a_vweb_application_compiles() {
spawn fn () {
time.sleep(2 * time.second)
exit(0)
}()
vweb.run(&App{}, 18081) vweb.run(&App{}, 18081)
} }
pub fn (mut app App) before_accept_loop() {
exit(0)
}
pub fn (mut app App) before_request() { pub fn (mut app App) before_request() {
app.user_id = app.get_cookie('id') or { '0' } 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('/') return app.redirect('/')
} }
fn (mut app App) time() { fn (mut app App) time() vweb.Result {
app.text(time.now().format()) return app.text(time.now().format())
} }
fn (mut app App) time_json() { fn (mut app App) time_json() vweb.Result {
app.json({ return app.json({
'time': time.now().format() 'time': time.now().format()
}) })
} }
fn (mut app App) time_json_pretty() { fn (mut app App) time_json_pretty() vweb.Result {
app.json_pretty({ return app.json_pretty({
'time': time.now().format() 'time': time.now().format()
}) })
} }