mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
all: string interpolation fixes
This commit is contained in:
parent
d653716292
commit
cc58d6a919
@ -165,8 +165,8 @@ fn (mut context Context) parse_options() ! {
|
||||
context.verbose = fp.bool('verbose', `v`, false, 'Be more verbose.')
|
||||
context.fail_on_maxtime = fp.int('max_time', `m`, max_time, 'Fail with exit code 2, when first cmd takes above M milliseconds (regression).')
|
||||
context.fail_on_regress_percent = fp.int('fail_percent', `f`, max_fail_percent, 'Fail with exit code 3, when first cmd is X% slower than the rest (regression).')
|
||||
context.cmd_template = fp.string('template', `t`, '{T}', 'Command template. {T} will be substituted with the current command.')
|
||||
cmd_params := fp.string_multi('parameter', `p`, 'A parameter substitution list. `{p}=val1,val2,val2` means that {p} in the template, will be substituted with each of val1, val2, val3.')
|
||||
context.cmd_template = fp.string('template', `t`, r'{T}', r'Command template. {T} will be substituted with the current command.')
|
||||
cmd_params := fp.string_multi('parameter', `p`, r'A parameter substitution list. `{p}=val1,val2,val2` means that {p} in the template, will be substituted with each of val1, val2, val3.')
|
||||
context.nmins = fp.int('nmins', `i`, 0, 'Ignore the BOTTOM X results (minimum execution time). Makes the results more robust to performance flukes.')
|
||||
context.nmaxs = fp.int('nmaxs', `a`, 1, 'Ignore the TOP X results (maximum execution time). Makes the results more robust to performance flukes.')
|
||||
for p in cmd_params {
|
||||
@ -212,7 +212,7 @@ fn (mut context Context) clear_line() {
|
||||
fn (mut context Context) expand_all_commands(commands []string) []string {
|
||||
mut all_commands := []string{}
|
||||
for cmd in commands {
|
||||
maincmd := context.cmd_template.replace('{T}', cmd)
|
||||
maincmd := context.cmd_template.replace(r'{T}', cmd)
|
||||
mut substituted_commands := []string{}
|
||||
substituted_commands << maincmd
|
||||
for paramk, paramlist in context.cmd_params {
|
||||
|
@ -141,7 +141,7 @@ $vdoctor_output
|
||||
|
||||
**What did you do?**
|
||||
`v -g -o vdbg cmd/v && vdbg $file_path`
|
||||
{file_content}
|
||||
\{file_content}
|
||||
|
||||
**What did you expect to see?**
|
||||
|
||||
@ -150,11 +150,11 @@ $expected_result
|
||||
**What did you see instead?**
|
||||
```
|
||||
$build_output```'
|
||||
mut encoded_body := urllib.query_escape(raw_body.replace_once('{file_content}', '```v\n$file_content\n```'))
|
||||
mut encoded_body := urllib.query_escape(raw_body.replace_once(r'{file_content}', '```v\n$file_content\n```'))
|
||||
mut generated_uri := 'https://github.com/vlang/v/issues/new?labels=Bug&body=$encoded_body'
|
||||
if generated_uri.len > 8192 {
|
||||
// GitHub doesn't support URLs longer than 8192 characters
|
||||
encoded_body = urllib.query_escape(raw_body.replace_once('{file_content}', 'See attached file `$file_path`'))
|
||||
encoded_body = urllib.query_escape(raw_body.replace_once(r'{file_content}', 'See attached file `$file_path`'))
|
||||
generated_uri = 'https://github.com/vlang/v/issues/new?labels=Bug&body=$encoded_body'
|
||||
println('Your file is too big to be submitted. Head over to the following URL and attach your file.')
|
||||
println(generated_uri)
|
||||
|
@ -504,7 +504,7 @@ fn test_struct_print() {
|
||||
}
|
||||
a.b << b
|
||||
a.b << b
|
||||
assert a.str() == '{Test [{1 2}, {1 2}]}'
|
||||
assert a.str() == r'{Test [{1 2}, {1 2}]}'
|
||||
assert b.str() == '{1 2}'
|
||||
assert a.b.str() == '[{1 2}, {1 2}]'
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user