Improve detect_os tests

This commit is contained in:
Ilan Cosman 2022-04-10 13:34:06 -07:00
parent 10ded01522
commit 366e69bf82
5 changed files with 52 additions and 11 deletions

View File

@ -5,11 +5,11 @@ all: fmt lint install test
.PHONY: fmt .PHONY: fmt
fmt: fmt:
@fish_indent --write **/*.fish @fish_indent --write **.fish
.PHONY: lint .PHONY: lint
lint: lint:
@for file in **/*.fish; fish --no-execute $$file; end @for file in **.fish; fish --no-execute $$file; end
.PHONY: install .PHONY: install
install: install:
@ -24,4 +24,4 @@ test: install littlecheck.py
@type -q mock || fisher install IlanCosman/clownfish @type -q mock || fisher install IlanCosman/clownfish
@fish tests/test_setup.fish @fish tests/test_setup.fish
@_tide_remove_unusable_items @_tide_remove_unusable_items
@_tide_cache_variables; python3 littlecheck.py --progress tests/*.test.fish @_tide_cache_variables; python3 littlecheck.py --progress tests/**.test.fish

View File

@ -1,8 +0,0 @@
# RUN: %fish %s
# Only run this test on macOS:
# REQUIRES: test $(uname) = Darwin
_tide_detect_os
# CHECK: 
# CHECK: D6D6D6
# CHECK: 333333

View File

@ -0,0 +1,26 @@
# RUN: %fish %s
mock uname \* "echo Darwin"
_tide_detect_os
# CHECK: 
# CHECK: D6D6D6
# CHECK: 333333
function _detect_os_linux_cases -a file
set -l dir (status dirname)
_tide_detect_os_linux_cases $dir/$file ID ||
_tide_detect_os_linux_cases $dir/$file ID_LIKE ||
_tide_detect_os_linux_cases $dir/$file DISTRIB_ID
end
_detect_os_linux_cases endeavouros-etc-release
# CHECK: 
# CHECK: 1793D1
# CHECK: 4D4D4D
# This tests spaces, e.g "opensuse suse"
_detect_os_linux_cases opensuse-etc-release
# CHECK: 
# CHECK: 73BA25
# CHECK: 173f4f

View File

@ -0,0 +1,11 @@
NAME=EndeavourOS
PRETTY_NAME=EndeavourOS
ID=endeavouros
ID_LIKE=arch
BUILD_ID=2021.12.17
ANSI_COLOR="38;2;23;147;209"
HOME_URL='https://endeavouros.com'
DOCUMENTATION_URL='https://forum.endeavouros.com/c/Arch-based-related-questions/bug-reports'
SUPPORT_URL='https://forum.endeavouros.com'
BUG_REPORT_URL='https://forum.endeavouros.com/c/arch-based-related-questions/bug-reports'
LOGO=endeavouros

View File

@ -0,0 +1,12 @@
NAME="openSUSE Tumbleweed"
# VERSION="20220408"
ID="opensuse-tumbleweed"
ID_LIKE="opensuse suse"
VERSION_ID="20220408"
PRETTY_NAME="openSUSE Tumbleweed"
ANSI_COLOR="0;32"
CPE_NAME="cpe:/o:opensuse:tumbleweed:20220408"
BUG_REPORT_URL="https://bugs.opensuse.org"
HOME_URL="https://www.opensuse.org/"
DOCUMENTATION_URL="https://en.opensuse.org/Portal:Tumbleweed"
LOGO="distributor-logo-Tumbleweed"