mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
dl: move 'example' to 'examples/dynamic_library_loading' (#9187)
This commit is contained in:
parent
8f0ede34ad
commit
9a7d9e047b
@ -11,20 +11,20 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
fn test_vexe() {
|
fn test_vexe() {
|
||||||
eprintln('vexe: $vexe')
|
dump(vexe)
|
||||||
assert vexe != ''
|
assert vexe != ''
|
||||||
eprintln('os.executable: ' + os.executable())
|
dump(os.executable())
|
||||||
eprintln('@FILE: ' + @FILE)
|
dump(@FILE)
|
||||||
eprintln('cfolder: $cfolder')
|
dump(cfolder)
|
||||||
eprintln('so_ext: $so_ext')
|
dump(so_ext)
|
||||||
eprintln('library_file_name: $library_file_name')
|
dump(library_file_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn test_can_compile_library() {
|
fn test_can_compile_library() {
|
||||||
os.chdir(cfolder)
|
os.chdir(cfolder)
|
||||||
os.rm(library_file_name) or { }
|
os.rm(library_file_name) or { }
|
||||||
res := v_compile('-d no_backtrace -o library -shared library.v')
|
res := v_compile('-d no_backtrace -o library -shared modules/library/library.v')
|
||||||
eprintln('res: $res')
|
dump(res)
|
||||||
assert os.is_file(library_file_name)
|
assert os.is_file(library_file_name)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,16 +32,16 @@ fn test_can_compile_main_program() {
|
|||||||
os.chdir(cfolder)
|
os.chdir(cfolder)
|
||||||
assert os.is_file(library_file_name)
|
assert os.is_file(library_file_name)
|
||||||
result := v_compile('run use.v')
|
result := v_compile('run use.v')
|
||||||
eprintln('result: $result')
|
dump(result)
|
||||||
assert result.output.contains('res: 4')
|
assert result.output.contains('res: 4')
|
||||||
os.rm(library_file_name) or { }
|
os.rm(library_file_name) or { }
|
||||||
}
|
}
|
||||||
|
|
||||||
fn v_compile(vopts string) os.Result {
|
fn v_compile(vopts string) os.Result {
|
||||||
cmd := '"$vexe" -showcc $vopts'
|
cmd := '"$vexe" -showcc $vopts'
|
||||||
eprintln('>>> v_compile cmd: $cmd')
|
dump(cmd)
|
||||||
res := os.exec(cmd) or { panic(err) }
|
res := os.exec(cmd) or { panic(err) }
|
||||||
eprintln('>>> v_compile res: $res')
|
dump(res)
|
||||||
// assert res.exit_code == 0
|
// assert res.exit_code == 0
|
||||||
$if !windows {
|
$if !windows {
|
||||||
os.system('ls -al $cfolder')
|
os.system('ls -al $cfolder')
|
Loading…
Reference in New Issue
Block a user