Implemented Terminal.bold(), foreground(), normal() and reset().

This commit is contained in:
Adam Murdoch
2012-08-04 14:08:19 +10:00
parent e9b300f610
commit 7ee843612a
9 changed files with 196 additions and 24 deletions

View File

@@ -3,6 +3,8 @@ package net.rubygrapefruit.platform
import org.junit.Rule
import org.junit.rules.TemporaryFolder
import spock.lang.Specification
import net.rubygrapefruit.platform.internal.Platform
import spock.lang.IgnoreIf
class TerminalTest extends Specification {
@Rule TemporaryFolder tmpDir
@@ -14,12 +16,23 @@ class TerminalTest extends Specification {
!terminal.isTerminal(TerminalAccess.Output.Stderr);
}
def "cannot access terminal from a test"() {
@IgnoreIf({Platform.current().windows})
def "cannot access posix terminal from a test"() {
when:
terminal.getTerminal(TerminalAccess.Output.Stdout)
then:
NativeException e = thrown()
e.message == 'Could not open terminal: not a terminal'
e.message == 'Could not open terminal for stdout: not a terminal'
}
@IgnoreIf({!Platform.current().windows})
def "cannot access windows console from a test"() {
when:
terminal.getTerminal(TerminalAccess.Output.Stdout)
then:
NativeException e = thrown()
e.message == 'Could not open console for stdout: not a console'
}
}