mirror of
https://github.com/vlang/v.git
synced 2025-09-17 19:36:35 -04:00
v.build_constraint: support // vtest build: false
and // vtest build: true
too; add tests
This commit is contained in:
parent
acfa088b60
commit
d970a8fce2
@ -15,6 +15,21 @@ fn test_eval_define() {
|
|||||||
assert !benv.is_define('xyz')
|
assert !benv.is_define('xyz')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn test_eval_true() {
|
||||||
|
assert benv.eval('true')!
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_eval_false() {
|
||||||
|
assert !benv.eval('false')!
|
||||||
|
}
|
||||||
|
|
||||||
|
fn test_eval_comment() {
|
||||||
|
assert benv.eval('true // some comment')!
|
||||||
|
assert benv.eval(' true// another comment ...')!
|
||||||
|
assert !benv.eval('false // some comment')!
|
||||||
|
assert !benv.eval(' false// another comment ...')!
|
||||||
|
}
|
||||||
|
|
||||||
fn test_eval_platforms_and_compilers() {
|
fn test_eval_platforms_and_compilers() {
|
||||||
assert benv.eval('tinyc')!
|
assert benv.eval('tinyc')!
|
||||||
assert benv.eval(' tinyc')!
|
assert benv.eval(' tinyc')!
|
||||||
|
@ -13,6 +13,7 @@ pub mut:
|
|||||||
// `defines` is a list of the user defines, for example: ['abc', 'gcboehm_opt', 'gg_record', 'show_fps']
|
// `defines` is a list of the user defines, for example: ['abc', 'gcboehm_opt', 'gg_record', 'show_fps']
|
||||||
pub fn new_environment(facts []string, defines []string) &Environment {
|
pub fn new_environment(facts []string, defines []string) &Environment {
|
||||||
mut b := &Environment{}
|
mut b := &Environment{}
|
||||||
|
b.facts['true'] = true
|
||||||
for f in facts {
|
for f in facts {
|
||||||
b.facts[f] = true
|
b.facts[f] = true
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user