bash - How do you programmatically add a bats test? -


i'd have bats test created every file in directory, i'm not sure best way done is. approach below creates single test when there many files in directory.

#!/usr/bin/env bats  in $(ls)   @test "testing $i" {     pwd   }   done 

to extract ls output not batter solution go wrong on filenames spaces.

you can below

shopt -s nullglob file in /dir/*   //test command on $file done shopt -u nullglob 

you can using find command also

find /some/directory -maxdepth 1 -type f -exec cmd option {} \; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -