OILS / test / spec-util.sh View on Github | oilshell.org

39 lines, 23 significant
1#!/usr/bin/env bash
2#
3# Usage:
4# test/spec-util.sh <function name>
5
6: ${LIB_OSH=stdlib/osh}
7source $LIB_OSH/bash-strict.sh
8source $LIB_OSH/task-five.sh
9
10REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
11source test/spec-common.sh
12
13run-file-with-osh-bash() {
14 local spec_name=$1
15 shift
16
17 # Note: there's no longer a way to run with 2 shells? We could do
18 # test/sh_spec.py --shells-from-argv foo.test.sh osh bash
19 echo TODO
20}
21
22_run-file-with-one() {
23 local shell=$1
24 local spec_name=$2
25 shift 2
26
27 # 2023-06: note --timeout 10 seems to make every test hang
28 # I guess $SH -i doesn't run well like that
29 sh-spec spec/$spec_name.test.sh \
30 --oils-bin-dir $PWD/bin \
31 -d \
32 -t \
33 $shell "$@"
34}
35
36run-file-with-osh() { _run-file-with-one $REPO_ROOT/bin/osh "$@"; }
37run-file-with-bash() { _run-file-with-one bash "$@"; }
38
39task-five "$@"