- Added Process.getPid() and Terminal.isTerminal().
- Added a test command-line app.
This commit is contained in:
@@ -4,9 +4,9 @@ import spock.lang.Specification
|
||||
import org.junit.Rule
|
||||
import org.junit.rules.TemporaryFolder
|
||||
|
||||
class UnixFileModeTest extends Specification {
|
||||
class PosixFileTest extends Specification {
|
||||
@Rule TemporaryFolder tmpDir
|
||||
final UnixFileMode file = Platform.get(UnixFileMode.class)
|
||||
final PosixFile file = Platform.get(PosixFile.class)
|
||||
|
||||
def "can set mode on a file"() {
|
||||
def testFile = tmpDir.newFile("test.txt")
|
||||
@@ -0,0 +1,15 @@
|
||||
package net.rubygrapefruit.platform
|
||||
|
||||
import org.junit.Rule
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import spock.lang.Specification
|
||||
|
||||
class ProcessTest extends Specification {
|
||||
@Rule TemporaryFolder tmpDir
|
||||
final Process process = Platform.get(Process.class)
|
||||
|
||||
def "can get PID"() {
|
||||
expect:
|
||||
process.getPid() != 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package net.rubygrapefruit.platform
|
||||
|
||||
import org.junit.Rule
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import spock.lang.Specification
|
||||
|
||||
class TerminalTest extends Specification {
|
||||
@Rule TemporaryFolder tmpDir
|
||||
final Terminal terminal = Platform.get(Terminal.class)
|
||||
|
||||
def "can check if attached to terminal"() {
|
||||
expect:
|
||||
!terminal.isTerminal(Terminal.Output.Stdout);
|
||||
!terminal.isTerminal(Terminal.Output.Stderr);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user