Ai
3 Star 1 Fork 0

Gitee 极速下载/purescript

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/purescript/purescript
克隆/下载
glob-test.sh 2.33 KB
一键复制 编辑 原始数据 按行查看 历史
#!/usr/bin/env bash
# This script assumes `ci/build.sh && cd sdist-test` has been run
# and that the program `tree` has been installed.
# Creates the following structure
# Foo.purs
# src/Bar.purs
# src/Bar/Baz.purs
#
# and verifies that the two kinds of input globs interact consistently.
set -eu -o pipefail
shopt -s nullglob
PURS="$(stack path --local-doc-root)/../bin/purs"
tmpdir=$(mktemp -d)
trap 'rm -rf "$tmpdir"' EXIT
cd "$tmpdir"
echo ::group::Environment info
echo "purs: ${PURS}"
echo "purs --version"
"${PURS}" --version
echo ::endgroup::
echo ::group::Setting up structure
mkdir -p "src/Bar"
cat > "Foo.purs" <<EOF
module Foo where
foo = 1 :: Int
EOF
cat > "src/Bar.purs" <<EOF
module Bar where
bar = 1 :: Int
EOF
cat > "src/Bar/Baz.purs" <<EOF
module Bar.Baz where
baz = 1 :: Int
EOF
cat > "globsAll" <<EOF
# Generated by Spago. Do not edit!
Foo.purs
src/**/*.purs
test/**/*.purs
EOF
cat > "globsNoFoo" <<EOF
# Generated by Spago. Do not edit!
src/**/*.purs
test/**/*.purs
EOF
tree . -L 3
echo ::endgroup::
echo ::group::Calling purs compile
"${PURS}" compile --output "out1" 'Foo.purs' 'src/**/*.purs' 'test/**/*.purs' 2>&1
EXPECTED=$(cd out1 && tree . 2>&1)
"${PURS}" compile --output "out2" --source-globs-file globsAll 2>&1
SOURCE_GLOBS=$(cd out2 && tree . 2>&1)
"${PURS}" compile --output "out3" --source-globs-file globsAll 'Foo.purs' 2>&1
MIXED_ALL=$(cd out3 && tree . 2>&1)
"${PURS}" compile --output "out4" --source-globs-file globsNoFoo 'Foo.purs' 2>&1
MIXED_NO_FOO=$(cd out4 && tree . 2>&1)
echo ::endgroup::
echo ::group::Running checks
if [ "${EXPECTED}" = "" ] ; then
echo "'purs compile' output should not be empty"
exit 1
fi
if [ "${EXPECTED}" = "${SOURCE_GLOBS}" ]; then
echo "SOURCE_GLOBS is correct"
else
echo "SOURCE_GLOBS output different from EXPECTED"
echo "Expected: ${EXPECTED}"
echo "SOURCE_GLOBS: ${SOURCE_GLOBS}"
exit 1
fi
if [ "${EXPECTED}" = "${MIXED_ALL}" ]; then
echo "MIXED_ALL is correct"
else
echo "MIXED_ALL output different from EXPECTED"
echo "Expected: ${MIXED_ALL}"
echo "MIXED_ALL: ${MIXED_ALL}"
exit 1
fi
if [ "${EXPECTED}" = "${MIXED_NO_FOO}" ]; then
echo "MIXED_NO_FOO is correct"
else
echo "MIXED_NO_FOO output different from EXPECTED"
echo "Expected: ${MIXED_NO_FOO}"
echo "MIXED_NO_FOO: ${MIXED_NO_FOO}"
exit 1
fi
echo "Tests passed"
echo ::endgroup::
exit 0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/mirrors/purescript.git
git@gitee.com:mirrors/purescript.git
mirrors
purescript
purescript
master

搜索帮助