1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

urllib: change Values.get to return an option type (#17636)

This commit is contained in:
Heptalon
2023-03-14 07:44:40 +01:00
committed by GitHub
parent daa9034583
commit 618c92a13b
3 changed files with 11 additions and 9 deletions

View File

@@ -3,11 +3,13 @@
// that can be found in the LICENSE file.
module urllib
fn test_add_key_val() {
fn test_add_and_get_key_val() {
mut values := Values{}
values.add('key', 'value')
val := values.get('key')
assert val == 'value'
present_val := values.get('key') or { '' }
absent_val := values.get('key1') or { '' }
assert present_val == 'value'
assert absent_val == ''
}
fn test_get_all_with_key() {