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 {
112
112
113
113
fn (mut g Gen) comp_at (node ast.AtExpr) {
114
114
if node.kind == .vmod_file {
115
- val := cnewlines (node.val.replace ('\r ' , '' ))
115
+ val := cnewlines (node.val.replace ('\r ' , '' )). replace ( ' \\ ' , ' \\\\ ' )
116
116
g.write ('tos_lit("$val ")' )
117
117
} else {
118
- g.write ('tos_lit("$node.val ")' )
118
+ val := node.val.replace ('\\ ' , '\\\\ ' )
119
+ g.write ('tos_lit("$val ")' )
119
120
}
120
121
}
121
122
Original file line number Diff line number Diff line change 1
- module scanner
2
-
3
1
import os
2
+ import v.pref
4
3
5
4
struct TestStruct {
6
5
test string
@@ -67,15 +66,7 @@ fn fn_name_mod_level_high_order(cb fn (int)) {
67
66
fn test_at_file () {
68
67
// Test @FILE
69
68
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'
79
70
}
80
71
81
72
fn test_at_fn () {
@@ -96,7 +87,7 @@ fn test_at_fn() {
96
87
97
88
fn test_at_mod () {
98
89
// Test @MOD
99
- assert @MOD == 'scanner '
90
+ assert @MOD == 'main '
100
91
}
101
92
102
93
fn test_at_struct () {
@@ -123,3 +114,7 @@ fn test_vmod_file() {
123
114
assert content.contains ('version:' )
124
115
assert content.contains ('description:' )
125
116
}
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