all: cleanup redundant `.ends_with(_test.v)` calls
parent
6477748e88
commit
7f5d654c3a
|
@ -545,8 +545,7 @@ fn (mut v Builder) cc() {
|
|||
builtin_obj_path := v.rebuild_cached_module(vexe, 'vlib/builtin')
|
||||
libs << builtin_obj_path
|
||||
for ast_file in v.parsed_files {
|
||||
is_test := ast_file.path.ends_with('_test.v') || ast_file.path.ends_with('_test.vv')
|
||||
if is_test && ast_file.mod.name != 'main' {
|
||||
if v.pref.is_test && ast_file.mod.name != 'main' {
|
||||
imp_path := v.find_module_path(ast_file.mod.name, ast_file.path) or {
|
||||
verror('cannot import module "$ast_file.mod.name" (not found)')
|
||||
break
|
||||
|
|
|
@ -245,7 +245,7 @@ pub fn (v &Builder) get_user_files() []string {
|
|||
if v.pref.is_prof {
|
||||
user_files << os.join_path(preludes_path, 'profiled_program.v')
|
||||
}
|
||||
is_test := dir.ends_with('_test.v') || dir.ends_with('_test.vv')
|
||||
is_test := v.pref.is_test
|
||||
mut is_internal_module_test := false
|
||||
if is_test {
|
||||
tcontent := os.read_file(dir) or {
|
||||
|
|
|
@ -215,8 +215,7 @@ pub fn cgen(files []ast.File, table &table.Table, pref &pref.Preferences) string
|
|||
}
|
||||
// println('\ncgen "$g.file.path" nr_stmts=$file.stmts.len')
|
||||
// building_v := true && (g.file.path.contains('/vlib/') || g.file.path.contains('cmd/v'))
|
||||
is_test := g.file.path.ends_with('_test.vv') || g.file.path.ends_with('_test.v')
|
||||
g.is_test = is_test
|
||||
g.is_test = g.pref.is_test
|
||||
if g.file.path == '' || !g.pref.autofree {
|
||||
// cgen test or building V
|
||||
// println('autofree=false')
|
||||
|
@ -1046,7 +1045,7 @@ fn (mut g Gen) stmt(node ast.Stmt) {
|
|||
// We are using prebuilt modules, we do not need to generate
|
||||
// their functions in main.c.
|
||||
if node.mod != 'main' && node.mod != 'help' && !should_bundle_module
|
||||
&& !g.file.path.ends_with('_test.v')&& node.generic_params.len == 0 {
|
||||
&& !g.pref.is_test&& node.generic_params.len == 0 {
|
||||
skip = true
|
||||
}
|
||||
}
|
||||
|
|
|
@ -82,14 +82,14 @@ pub fn gen(files []ast.File, table &table.Table, pref &pref.Preferences) string
|
|||
for file in files {
|
||||
g.file = file
|
||||
g.enter_namespace(g.file.mod.name)
|
||||
g.is_test = g.file.path.ends_with('_test.v') || g.file.path.ends_with('_test.vv')
|
||||
g.is_test = g.pref.is_test
|
||||
g.find_class_methods(file.stmts)
|
||||
g.escape_namespace()
|
||||
}
|
||||
for file in files {
|
||||
g.file = file
|
||||
g.enter_namespace(g.file.mod.name)
|
||||
g.is_test = g.file.path.ends_with('_test.v') || g.file.path.ends_with('_test.vv')
|
||||
g.is_test = g.pref.is_test
|
||||
// store imports
|
||||
mut imports := []string{}
|
||||
for imp in g.file.imports {
|
||||
|
|
Loading…
Reference in New Issue