diff --git a/cmd/tools/repeat.v b/cmd/tools/repeat.v index 6e0571a2dd..16ca9e9805 100644 --- a/cmd/tools/repeat.v +++ b/cmd/tools/repeat.v @@ -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 { diff --git a/cmd/tools/vbug.v b/cmd/tools/vbug.v index f5cd708452..363a40ce63 100644 --- a/cmd/tools/vbug.v +++ b/cmd/tools/vbug.v @@ -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) diff --git a/vlib/builtin/js/array_test.js.v b/vlib/builtin/js/array_test.js.v index d8520f0041..c9089e7fc8 100644 --- a/vlib/builtin/js/array_test.js.v +++ b/vlib/builtin/js/array_test.js.v @@ -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}]' } diff --git a/vlib/v/gen/js/js.v b/vlib/v/gen/js/js.v index 7d9bab0464..346aa5f3f7 100644 --- a/vlib/v/gen/js/js.v +++ b/vlib/v/gen/js/js.v @@ -152,9 +152,9 @@ pub fn gen(files []&ast.File, table &ast.Table, pref &pref.Preferences) string { // builtin types if g.file.mod.name == 'builtin' && !g.generated_builtin { g.gen_builtin_type_defs() - g.writeln('Object.defineProperty(array.prototype,"len", { get: function() {return new int(this.arr.arr.length);}, set: function(l) { this.arr.arr.length = l.valueOf(); } }); ') - g.writeln('Object.defineProperty(map.prototype,"len", { get: function() {return new int(this.length);}, set: function(l) { } }); ') - g.writeln('Object.defineProperty(array.prototype,"length", { get: function() {return new int(this.arr.arr.length);}, set: function(l) { this.arr.arr.length = l.valueOf(); } }); ') + g.writeln('Object.defineProperty(array.prototype,"len", { get: function() { return new int(this.arr.arr.length);}, set: function(l) { this.arr.arr.length = l.valueOf(); } }); ') + g.writeln('Object.defineProperty(map.prototype,"len", { get: function() { return new int(this.length);}, set: function(l) { } }); ') + g.writeln('Object.defineProperty(array.prototype,"length", { get: function() { return new int(this.arr.arr.length);}, set: function(l) { this.arr.arr.length = l.valueOf(); } }); ') g.generated_builtin = true } if g.is_test && !tests_inited {