From d94473e1d4f2b487159499e0e9509937a77a3716 Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 2 Aug 2024 01:17:39 +0300 Subject: [PATCH] tests, tools: add short command tests in `v test-all`, to ensure `-d trace_http_request` and `-d trace_http_response` do not regress (#21981) --- cmd/tools/vtest-all.v | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmd/tools/vtest-all.v b/cmd/tools/vtest-all.v index 8b02a9b7f74f13..88f3c5fd948f49 100644 --- a/cmd/tools/vtest-all.v +++ b/cmd/tools/vtest-all.v @@ -365,6 +365,22 @@ fn get_all_commands() []Command { line: '${vexe} install nedpals.args' okmsg: '`v install` works.' } + res << Command{ + okmsg: 'Running net.http with -d trace_http_request works.' + line: '${vexe} -d trace_http_request -e \'import net.http; x := http.fetch(url: "https://vpm.url4e.com/some/unknown/url")!; println(x.status_code)\'' + runcmd: .execute + starts_with: '> GET /some/unknown/url HTTP/1.1' + contains: 'User-Agent: v.http' + ends_with: '404\n' + } + res << Command{ + okmsg: 'Running net.http with -d trace_http_response works.' + line: '${vexe} -d trace_http_response -e \'import net.http; x := http.fetch(url: "https://vpm.url4e.com/some/unknown/url")!; println(x.status_code)\'' + runcmd: .execute + starts_with: '< HTTP/1.1 404 Not Found' + contains: 'Server: nginx' + ends_with: '404\n' + } res << Command{ line: '${vexe} -usecache -cg examples/hello_world.v' okmsg: '`v -usecache -cg` works.'