Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pPrecel committed Jul 27, 2024
1 parent 2a43fb3 commit 2b99def
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 34 deletions.
Empty file modified lib/run_with_prefix.fish
100644 → 100755
Empty file.
27 changes: 27 additions & 0 deletions tests/brew.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env fish

set DOTFILES_ROOT (pwd -P)

source $DOTFILES_ROOT/lib/lib.fish

set -l file_path $argv[1]
set -l cask $argv[2]

set -l brew_list
while read -la line
set brew_list $brew_list $line
end < $file_path

for val in $brew_list
if test -n "$cask"
make "Looking for $val"
brew search --cask $val >/dev/null
or abort $val
success Found $val
else
make "Looking for $val"
brew search $val >/dev/null
or abort $val
success Found $val
end
end
38 changes: 4 additions & 34 deletions tests/deps.fish
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,16 @@

set DOTFILES_ROOT (pwd -P)

source $DOTFILES_ROOT/scripts/common.fish

function brew_check
set -l file_path $argv[1]
set -l cask $argv[2]

set -l brew_list
while read -la line
set brew_list $brew_list $line
end < $file_path

for val in $brew_list
if test -n "$cask"
brew search --cask $val >/dev/null
or abort $val
info 'found' $val
else
brew search $val >/dev/null
or abort $val
info 'found' $val
end
end
end

function check_vscode
cat $DOTFILES_ROOT/vscode/extensions | while read line
code --install-extension "$line" >/dev/null
and info_installation_complete "$line"
or abort_installation "$line"
end
end
source $DOTFILES_ROOT/lib/lib.fish

make "Checking brew list..."
and brew_check $DOTFILES_ROOT/scripts/brew_list
and run_with_prefix $DOTFILES_ROOT/tests/brew.fish $DOTFILES_ROOT/pre_modules/pkg_manager/brew
and success "List is ok"

make "Checking brew cask list..."
and brew_check $DOTFILES_ROOT/scripts/brew_list_cask "true"
and run_with_prefix $DOTFILES_ROOT/tests/brew.fish $DOTFILES_ROOT/pre_modules/pkg_manager/brew_cask "true"
and success "Cask list is ok"

make "Checking vscode extensions..."
and check_vscode
and run_with_prefix $DOTFILES_ROOT/tests/vscode.fish
and success "Vscode extensions are valid"
12 changes: 12 additions & 0 deletions tests/vscode.fish
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/usr/bin/env fish

set DOTFILES_ROOT (pwd -P)

source $DOTFILES_ROOT/lib/lib.fish

cat $DOTFILES_ROOT/modules/vscode/extensions | while read line
make "Looking for $line"
code --install-extension "$line" >/dev/null
and info_installation_complete "$line"
or abort_installation "$line"
end

0 comments on commit 2b99def

Please sign in to comment.