File tree Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Expand file tree Collapse file tree 2 files changed +10
-14
lines changed Original file line number Diff line number Diff line change @@ -112,10 +112,11 @@ fn cgen_attrs(attrs []table.Attr) []string {
112112
113113fn (mut g Gen) comp_at (node ast.AtExpr) {
114114 if node.kind == .vmod_file {
115- val := cnewlines (node.val.replace ('\r ' , '' ))
115+ val := cnewlines (node.val.replace ('\r ' , '' )). replace ( ' \\ ' , ' \\\\ ' )
116116 g.write ('tos_lit("$val ")' )
117117 } else {
118- g.write ('tos_lit("$node.val ")' )
118+ val := node.val.replace ('\\ ' , '\\\\ ' )
119+ g.write ('tos_lit("$val ")' )
119120 }
120121}
121122
Original file line number Diff line number Diff line change 1- module scanner
2-
31import os
2+ import v.pref
43
54struct TestStruct {
65 test string
@@ -67,15 +66,7 @@ fn fn_name_mod_level_high_order(cb fn (int)) {
6766fn test_at_file () {
6867 // Test @FILE
6968 f := os.file_name (@FILE)
70- $if windows {
71- // TODO all after Drive letter
72- // no_drive := f.all_after(':')
73- // TODO assert the variable name on Windows???
74- // assert no_drive == 'scanner_at_literals_test.v'
75- assert true
76- } $else {
77- assert f == 'scanner_at_literals_test.v'
78- }
69+ assert f == 'comptime_at_test.v'
7970}
8071
8172fn test_at_fn () {
@@ -96,7 +87,7 @@ fn test_at_fn() {
9687
9788fn test_at_mod () {
9889 // Test @MOD
99- assert @MOD == 'scanner '
90+ assert @MOD == 'main '
10091}
10192
10293fn test_at_struct () {
@@ -123,3 +114,7 @@ fn test_vmod_file() {
123114 assert content.contains ('version:' )
124115 assert content.contains ('description:' )
125116}
117+
118+ fn test_comptime_at () {
119+ assert @VEXE == pref.vexe_path ()
120+ }
You can’t perform that action at this time.
0 commit comments