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

50-output-11-batslib_count_lines.bats « test - github.com/bats-core/bats-support.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ea172c3edb893f4064bc4baabd57d919bcdfe724 (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_count_lines() <string>: displays the number of lines in <string>' {
  run batslib_count_lines $'a\nb\nc\n'
  [ "$status" -eq 0 ]
  [ "$output" == '3' ]
}

@test 'batslib_count_lines() <string>: counts the last line when it is not terminated by a newline' {
  run batslib_count_lines $'a\nb\nc'
  [ "$status" -eq 0 ]
  [ "$output" == '3' ]
}

@test 'batslib_count_lines() <string>: counts empty lines' {
  run batslib_count_lines $'\n\n\n'
  [ "$status" -eq 0 ]
  [ "$output" == '3' ]
}