mirror of
https://git.sr.ht/~lattis/muon
synced 2026-01-30 11:25:37 +00:00
59 lines
1.3 KiB
Plaintext
59 lines
1.3 KiB
Plaintext
# SPDX-FileCopyrightText: Stone Tickle <lattis@mochiro.moe>
|
|
# SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
env = environment({'other_key': 'val', 'other_key2': 'val1'})
|
|
env.set('noval', '')
|
|
env.set('key', 'val')
|
|
env.prepend('other_key2', 'hello')
|
|
env.set('key2', 'val', 'val2', separator: '!!')
|
|
env.append('key2', 'val', 'val2', separator: ';;')
|
|
env.append('inherited', 'new!')
|
|
|
|
d = {}
|
|
foreach line : run_command(
|
|
'env',
|
|
env: env,
|
|
check: true,
|
|
).stdout().strip().split('\n')
|
|
if line.contains('=')
|
|
l = line.split('=')
|
|
d += {l[0]: l[1]}
|
|
endif
|
|
endforeach
|
|
|
|
assert(d['inherited'] == 'secret:new!')
|
|
assert(d['other_key'] == 'val')
|
|
assert(d['other_key2'] == 'hello:val1')
|
|
assert(d['key'] == 'val')
|
|
assert(d['key2'] == 'val!!val2;;val;;val2')
|
|
assert(d['noval'] == '')
|
|
|
|
d = {}
|
|
foreach line : run_command(
|
|
'env',
|
|
env: 'test=1',
|
|
check: true,
|
|
).stdout().strip().split('\n')
|
|
if line.contains('=')
|
|
l = line.split('=')
|
|
d += {l[0]: l[1]}
|
|
endif
|
|
endforeach
|
|
|
|
assert(d['test'] == '1')
|
|
|
|
d = {}
|
|
foreach line : run_command(
|
|
'env',
|
|
env: ['test=1', 'test2=2'],
|
|
check: true,
|
|
).stdout().strip().split('\n')
|
|
if line.contains('=')
|
|
l = line.split('=')
|
|
d += {l[0]: l[1]}
|
|
endif
|
|
endforeach
|
|
|
|
assert(d['test'] == '1')
|
|
assert(d['test2'] == '2')
|