Welcome to mirror list, hosted at ThFree Co, Russian Federation.

50-output-13-batslib_get_max_single_line_key_width.bats « test - github.com/bats-core/bats-support.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e6af161f34af80604b640a9b2628fea76ef8b6d1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env bats

load test_helper

@test 'batslib_get_max_single_line_key_width() <pair...>: displays the length of the longest key' {
  local -ar pairs=( 'k _1'  'v 1'
                    'k 2'   'v 2'
                    'k __3' 'v 3' )
  run batslib_get_max_single_line_key_width "${pairs[@]}"
  [ "$status" -eq 0 ]
  [ "$output" == '5' ]
}

@test 'batslib_get_max_single_line_key_width() <pair...>: only considers keys with single-line values' {
  local -ar pairs=( 'k _1'  'v 1'
                    'k 2'   'v 2'
                    'k __3' $'v\n3' )
  run batslib_get_max_single_line_key_width "${pairs[@]}"
  [ "$status" -eq 0 ]
  [ "$output" == '4' ]
}