Skip to content

Commit

Permalink
Merge branch 'master' into jhrcek/refactor-plugin-unify-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelpj committed Feb 1, 2024
2 parents 2b4074e + 90eed1a commit f5374b9
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 21 deletions.
16 changes: 6 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,12 @@ jobs:
# run the tests without parallelism, otherwise tasty will attempt to run
# all functional test cases simultaneously which causes way too many hls
# instances to be spun up for the poor github actions runner to handle
#
# See https://github.com/ocharles/tasty-rerun/issues/22 for why we need
# to include 'new' in the filters, since many of our test suites are in the
# same package.
run: |
echo "TEST_OPTS=-j1 --rerun-update --rerun-filter failures,exceptions" >> $GITHUB_ENV
- name: Cache test log between attempts of the same run
uses: actions/cache@v3
env:
cache-name: cache-test-log
with:
path: "**/.tasty-rerun-log*"
key: v1-${{ runner.os }}-${{ matrix.ghc }}-test-log-${{ github.sha }}
echo "TEST_OPTS=-j1 --rerun-update --rerun-filter failures,exceptions,new" >> $GITHUB_ENV
- if: matrix.test
name: Test hls-graph
Expand Down Expand Up @@ -236,7 +232,7 @@ jobs:
## version needs to be limited since the tests depend on cabal-fmt which only builds using specific ghc versions
- if: matrix.test && matrix.ghc == '9.2'
name: Test hls-cabal-fmt-plugin test suite
run: cabal test hls-cabal-fmt-plugin-tests --flag=isolateTests --test-options="$TEST_OPTS" || cabal test hls-cabal-fmt-plugin-tests --flag=isolateTests --test-options="$TEST_OPTS"
run: cabal test hls-cabal-fmt-plugin-tests --flag=isolateCabalfmtTests --test-options="$TEST_OPTS" || cabal test hls-cabal-fmt-plugin-tests --flag=isolateCabalfmtTests --test-options="$TEST_OPTS"

- if: matrix.test
name: Test hls-cabal-plugin test suite
Expand Down
10 changes: 5 additions & 5 deletions plugins/hls-eval-plugin/test/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ tests =
, goldenWithEvalAndFs "Transitive local dependency" (FS.directProjectMulti ["TTransitive.hs", "TLocalImport.hs", "Util.hs"]) "TTransitive" "hs"
-- , goldenWithEval "Local Modules can be imported in a test" "TLocalImportInTest" "hs"
, goldenWithEval "Setting language option TupleSections" "TLanguageOptionsTupleSections" "hs"
, goldenWithEval' ":set accepts ghci flags" "TFlags" "hs" (if ghcVersion >= GHC92 then "ghc98.expected" else if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
, goldenWithEval' ":set accepts ghci flags" "TFlags" "hs" (if ghcVersion >= GHC98 then "ghc98.expected" else if ghcVersion >= GHC92 then "ghc92.expected" else "expected")
, testCase ":set -fprint-explicit-foralls works" $ do
evalInFile "T8.hs" "-- >>> :t id" "-- id :: a -> a"
evalInFile "T8.hs" "-- >>> :set -fprint-explicit-foralls\n-- >>> :t id"
Expand All @@ -141,11 +141,11 @@ tests =
, goldenWithEval "The default language extensions for the eval plugin are the same as those for ghci" "TSameDefaultLanguageExtensionsAsGhci" "hs"
, goldenWithEval "IO expressions are supported, stdout/stderr output is ignored" "TIO" "hs"
, goldenWithEvalAndFs "Property checking" cabalProjectFS "TProperty" "hs"
, goldenWithEvalAndFs' "Property checking with exception" cabalProjectFS "TPropertyError" "hs" (
if ghcVersion >= GHC96 then
, knownBrokenInEnv [HostOS Windows] "The output has path separators in it, which on Windows look different. Just skip it there" $ goldenWithEvalAndFs' "Property checking with exception" cabalProjectFS "TPropertyError" "hs" (
if ghcVersion >= GHC98 then
"ghc98.expected"
else if ghcVersion >= GHC96 then
"ghc96.expected"
else if ghcVersion >= GHC94 && hostOS == Windows then
"windows-ghc94.expected"
else if ghcVersion >= GHC94 then
"ghc94.expected"
else
Expand Down
8 changes: 8 additions & 0 deletions plugins/hls-eval-plugin/test/testdata/T14.ghc98.expected.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{-# LANGUAGE TypeApplications #-}
module T14 where

foo :: Show a => a -> String
foo = show

-- >>> :type foo @Int
-- foo @Int :: Show Int => Int -> String
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ Options apply only in the section where they are defined (unless they are in the
>>> class L a b c
Too many parameters for class `L'
(Enable MultiParamTypeClasses to allow multi-parameter classes)
In the class declaration for `L'
-}

Expand All @@ -33,7 +32,6 @@ Not set yet:
>>> class D
No parameters for class `D'
(Enable MultiParamTypeClasses to allow no-parameter classes)
In the class declaration for `D'
Now it works:
Expand All @@ -57,7 +55,7 @@ It still works
{- Invalid option/flags are reported, but valid ones will be reflected
>>> :set -XRank2Types -XAbsent -XDatatypeContexts -XWrong -fprint-nothing-at-all
<interactive>: warning:
<interactive>: warning: [GHC-53692] [-Wdeprecated-flags (in -Wdefault)]
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
Some flags have not been recognized: -XAbsent, -XWrong, -fprint-nothing-at-all
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ module TProperty where
-- Exception:
-- Prelude.head: empty list
-- CallStack (from HasCallStack):
-- error, called at libraries\base\GHC\List.hs:1646:3 in base:GHC.List
-- errorEmptyList, called at libraries\base\GHC\List.hs:85:11 in base:GHC.List
-- badHead, called at libraries\base\GHC\List.hs:81:28 in base:GHC.List
-- error, called at libraries/base/GHC/List.hs:1782:3 in base:GHC.List
-- errorEmptyList, called at libraries/base/GHC/List.hs:89:11 in base:GHC.List
-- badHead, called at libraries/base/GHC/List.hs:83:28 in base:GHC.List
-- head, called at <interactive>:1:27 in interactive:Ghci2
-- []

0 comments on commit f5374b9

Please sign in to comment.