blob: 3845e239dc2b74c418c5e4c931ab1b444932765e (
plain)
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
|
package frege.gradle.tasks
import frege.gradle.integtest.fixtures.AbstractFregeIntegrationSpec
import static org.gradle.testkit.runner.TaskOutcome.FAILED
class FregeCompileIntegTest extends AbstractFregeIntegrationSpec {
List<File> pluginClasspath
def setup() {
buildFile << """
plugins {
id 'org.frege-lang.base'
}
import frege.gradle.tasks.FregeCompile
repositories { jcenter() }
configurations { frege {} }
dependencies {
frege "org.frege-lang:frege:$DEFAULT_FREGE_VERSION"
}
task compile(type: FregeCompile) {
destinationDir = file("frege-output")
source("frege-src")
module = "frege-src"
classpath = configurations.frege
fregepath = configurations.frege
}
"""
testProjectDir.newFolder("frege-src")
}
def "shows compile errors"() {
given:
simpleFrege()
failingFrege()
when:
def result = fail("compile")
then:
result.task(":compile").outcome == FAILED
result.output.contains("Failing.fr:6: can't resolve `Hello`")
}
def failingFrege() {
def failingFrege = testProjectDir.newFile("frege-src/Failing.fr")
failingFrege << """
module Failing where
failingFun _ = do
println(Hello)
"""
}
def simpleFrege() {
def helloFrege = testProjectDir.newFile("frege-src/Hello.fr")
helloFrege << """
module Hello where
import frege.prelude.PreludeBase
main _ = do
println("Hello From Frege")
"""
}
}
|