Some more coverage for unicode handling.

This commit is contained in:
Adam Murdoch
2013-02-26 07:06:02 +11:00
parent f3af019c41
commit 8215a58f07
2 changed files with 7 additions and 8 deletions

View File

@@ -42,7 +42,7 @@ class PosixFileTest extends Specification {
file.getMode(testFile) == 0740 file.getMode(testFile) == 0740
where: where:
fileName << ["test.txt", "test\u03b1.txt"] fileName << ["test.txt", "test\u03b1\u2295.txt"]
} }
def "cannot set mode on file that does not exist"() { def "cannot set mode on file that does not exist"() {
@@ -114,9 +114,9 @@ class PosixFileTest extends Specification {
} }
def "can create and read symlink with unicode in its name"() { def "can create and read symlink with unicode in its name"() {
def testFile = new File(tmpDir.root, "target\u03b2") def testFile = new File(tmpDir.root, "target\u03b2\u2295")
testFile.text = 'hi' testFile.text = 'hi'
def symlinkFile = new File(tmpDir.root, "symlink\u03b2") def symlinkFile = new File(tmpDir.root, "symlink\u03b2\u2296")
when: when:
file.symlink(symlinkFile, testFile.name) file.symlink(symlinkFile, testFile.name)

View File

@@ -19,7 +19,6 @@ package net.rubygrapefruit.platform
import org.junit.Rule import org.junit.Rule
import org.junit.rules.TemporaryFolder import org.junit.rules.TemporaryFolder
import spock.lang.Specification import spock.lang.Specification
import spock.lang.Unroll
class ProcessTest extends Specification { class ProcessTest extends Specification {
@Rule TemporaryFolder tmpDir @Rule TemporaryFolder tmpDir
@@ -58,7 +57,7 @@ class ProcessTest extends Specification {
process.workingDirectory = original process.workingDirectory = original
where: where:
dir << ['dir', 'dir\u03b1'] dir << ['dir', 'dir\u03b1\u2295']
} }
def "cannot set working directory to a directory that does not exist"() { def "cannot set working directory to a directory that does not exist"() {
@@ -98,9 +97,9 @@ class ProcessTest extends Specification {
System.getenv()[varName] == null System.getenv()[varName] == null
where: where:
varName | varValue varName | varValue
'TEST_ENV_VAR' | 'test value' 'TEST_ENV_VAR' | 'test value'
'TEST_ENV_VAR\u03b1' | 'value\u03b2' 'TEST_ENV_VAR\u2295\u03b1' | 'value\u03b2\u2296'
} }
def "setting environment variable to null or empty string remove the environment variable"() { def "setting environment variable to null or empty string remove the environment variable"() {