1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
|
---------------------------------------------------------------------
RUN tests/cpp-full.hs
FILE tests/cpp-full.hs
/* this is a test */
main = putStrLn $ show "Hello"
OUTPUT
tests/cpp-full.hs:3:8-30: Warning: Use print
Found:
putStrLn $ show "Hello"
Perhaps:
print "Hello"
1 hint
---------------------------------------------------------------------
RUN -XNoCPP tests/cpp-none.hs
FILE tests/cpp-none.hs
#include "Any/File.h"
main = print "Hello"
EXIT 0
OUTPUT
No hints
---------------------------------------------------------------------
RUN -XNoCPP tests/cpp-must-not-run.hs
FILE tests/cpp-must-not-run.hs
{-
#error Cpp has run
-}
main = undefined
EXIT 0
OUTPUT
No hints
---------------------------------------------------------------------
RUN --cpp-define FOO tests/cpp-ext-enable.hs
FILE tests/cpp-ext-enable.hs
{-# LANGUAGE CPP #-}
#if defined(FOO)
{-# LANGUAGE Foo #-}
#endif
main = undefined
EXIT 1
OUTPUT
tests/cpp-ext-enable.hs:1:1: Error: Parse error: tests/cpp-ext-enable.hs:3:14: error: [GHC-46537]
Unsupported extension: Foo
Found:
{-# LANGUAGE CPP #-}
{-# LANGUAGE Foo #-}
main = undefined
1 error
---------------------------------------------------------------------
RUN tests/cpp-ext-disable.hs
FILE tests/cpp-ext-disable.hs
{-# LANGUAGE CPP #-}
#if defined(FOO)
{-# LANGUAGE Foo #-}
#endif
main = undefined
EXIT 1
OUTPUT
tests/cpp-ext-disable.hs:1:1-20: Warning: Avoid restricted extensions
Found:
{-# LANGUAGE CPP #-}
Note: may break the code
1 hint
---------------------------------------------------------------------
RUN --cpp-simple tests/cpp-simple.hs
FILE tests/cpp-simple.hs
#include "Any/File.h"
main = print "Hello"
OUTPUT
No hints
---------------------------------------------------------------------
RUN tests/cpp-file1.hs
FILE tests/cpp-file1.hs
import Network.Wai
#if MIN_VERSION_wai(2, 0, 0)
import Network.Wai.Internal
#endif
OUTPUT
No hints
---------------------------------------------------------------------
RUN --cpp-file=tests/cabal_macros.h tests/cpp-file2.hs
FILE tests/cabal_macros.h
#define MIN_VERSION_wai(a,b,c) 1
FILE tests/cpp-file2.hs
import Network.Wai
#if MIN_VERSION_wai(2, 0, 0)
import Network.Wai.Internal
#endif
foo = map f . map g
OUTPUT
tests/cpp-file2.hs:5:7-19: Suggestion: Use map once
Found:
map f . map g
Perhaps:
map (f . g)
1 hint
---------------------------------------------------------------------
RUN --cpp-simple tests/cpp-file3.hs
FILE tests/cpp-file3.hs
import Network.Wai
#if MIN_VERSION_wai(2, 0, 0)
import Network.Wai.Internal
#endif
OUTPUT
No hints
---------------------------------------------------------------------
RUN --cpp-simple tests/cpp-file4.hs
FILE tests/cpp-file4.hs
import Network.Wai
#if defined(MIN_VERSION_wai) && MIN_VERSION_wai(2, 0, 0)
import Network.Wai.Internal
#endif
OUTPUT
No hints
---------------------------------------------------------------------
RUN tests/cpp-file5.hs
FILE tests/cpp-file5.hs
{-# LANGUAGE CPP #-}
main =
#if __GLASGOW_HASKELL__ > 800
print __GLASGOW_HASKELL__
#else
putStrLn $ show __GLASGOW_HASKELL__
#endif
OUTPUT
tests/cpp-file5.hs:1:1-20: Warning: Avoid restricted extensions
Found:
{-# LANGUAGE CPP #-}
Note: may break the code
1 hint
---------------------------------------------------------------------
RUN --cpp-define "__GLASGOW_HASKELL__=123" tests/cpp-file6.hs
FILE tests/cpp-file6.hs
{-# LANGUAGE CPP #-}
main =
#if __GLASGOW_HASKELL__ == 123
print __GLASGOW_HASKELL__
#else
putStrLn $ show __GLASGOW_HASKELL__
#endif
OUTPUT
tests/cpp-file6.hs:1:1-20: Warning: Avoid restricted extensions
Found:
{-# LANGUAGE CPP #-}
Note: may break the code
1 hint
|