Add record_tests.sh.
This commit is contained in:
parent
5837e98072
commit
21d19e1743
|
@ -1,45 +1,64 @@
|
|||
Feature: Generate command
|
||||
Scenario: in file
|
||||
When I run `runcuckoo generate --no-timestamp --output Actual.swift SourceFiles/TestedClass.swift SourceFiles/TestedProtocol.swift`
|
||||
Then the file "SourceFiles/Expected/GeneratedMocks.swift" should be equal to file "Actual.swift"
|
||||
Scenario: in directory
|
||||
When I run `runcuckoo generate --no-timestamp --output . SourceFiles/ClassWithAttributes.swift SourceFiles/Imports.swift`
|
||||
Then the file "SourceFiles/Expected/ClassWithAttributes.swift" should be equal to file "ClassWithAttributes.swift"
|
||||
And the file "SourceFiles/Expected/Imports.swift" should be equal to file "Imports.swift"
|
||||
|
||||
# Recorded tests
|
||||
|
||||
Scenario: class with attributes
|
||||
When I run `runcuckoo generate --no-timestamp --output ClassWithAttributes.swift SourceFiles/ClassWithAttributes.swift`
|
||||
Then the file "Expected/ClassWithAttributes.swift" should be equal to file "ClassWithAttributes.swift"
|
||||
|
||||
Scenario: class with init
|
||||
When I run `runcuckoo generate --no-timestamp --output ClassWithInit.swift SourceFiles/ClassWithInit.swift`
|
||||
Then the file "Expected/ClassWithInit.swift" should be equal to file "ClassWithInit.swift"
|
||||
|
||||
Scenario: output not specified
|
||||
When I run `runcuckoo generate --no-timestamp SourceFiles/TestedClass.swift SourceFiles/TestedProtocol.swift`
|
||||
Then the file "SourceFiles/Expected/GeneratedMocks.swift" should be equal to file "GeneratedMocks.swift"
|
||||
Then the file "Expected/GeneratedMocks.swift" should be equal to file "GeneratedMocks.swift"
|
||||
|
||||
Scenario: imports
|
||||
When I run `runcuckoo generate --no-timestamp --output Imports.swift SourceFiles/Imports.swift`
|
||||
Then the file "Expected/Imports.swift" should be equal to file "Imports.swift"
|
||||
|
||||
Scenario: multiple classes
|
||||
When I run `runcuckoo generate --no-timestamp --output MultipleClasses.swift SourceFiles/MultipleClasses.swift`
|
||||
Then the file "Expected/MultipleClasses.swift" should be equal to file "MultipleClasses.swift"
|
||||
|
||||
Scenario: no header
|
||||
When I run `runcuckoo generate --no-header --output NoHeader.swift SourceFiles/EmptyClass.swift`
|
||||
Then the file "Expected/NoHeader.swift" should be equal to file "NoHeader.swift"
|
||||
|
||||
Scenario: struct
|
||||
When I run `runcuckoo generate --no-timestamp --output Struct.swift SourceFiles/Struct.swift`
|
||||
Then the file "Expected/Struct.swift" should be equal to file "Struct.swift"
|
||||
|
||||
Scenario: testableFrameworks
|
||||
When I run `runcuckoo generate --no-timestamp --testable "Cuckoo,A b,A-c,A.d" --output Actual.swift SourceFiles/EmptyClass.swift`
|
||||
Then the file "SourceFiles/Expected/TestableFrameworks.swift" should be equal to file "Actual.swift"
|
||||
When I run `runcuckoo generate --no-timestamp --testable "Cuckoo,A b,A-c,A.d" --output TestableFrameworks.swift SourceFiles/EmptyClass.swift`
|
||||
Then the file "Expected/TestableFrameworks.swift" should be equal to file "TestableFrameworks.swift"
|
||||
|
||||
# Not recorded tests
|
||||
|
||||
Scenario: non existing input file
|
||||
When I run `runcuckoo generate non_existing_file.swift`
|
||||
Then the output should contain:
|
||||
"""
|
||||
Could not read contents of `non_existing_file.swift`
|
||||
"""
|
||||
Scenario: no header
|
||||
When I run `runcuckoo generate --no-header --output Actual.swift SourceFiles/EmptyClass.swift`
|
||||
Then the file "SourceFiles/Expected/NoHeader.swift" should be equal to file "Actual.swift"
|
||||
Scenario: multiple classes in one file
|
||||
When I run `runcuckoo generate --no-timestamp --output Actual.swift SourceFiles/MultipleClasses.swift`
|
||||
Then the file "SourceFiles/Expected/MultipleClasses.swift" should be equal to file "Actual.swift"
|
||||
Scenario: class with attributes
|
||||
When I run `runcuckoo generate --no-timestamp --output Actual.swift SourceFiles/ClassWithAttributes.swift`
|
||||
Then the file "SourceFiles/Expected/ClassWithAttributes.swift" should be equal to file "Actual.swift"
|
||||
Scenario: imports
|
||||
When I run `runcuckoo generate --no-timestamp --output Actual.swift SourceFiles/Imports.swift`
|
||||
Then the file "SourceFiles/Expected/Imports.swift" should be equal to file "Actual.swift"
|
||||
Scenario: struct
|
||||
When I run `runcuckoo generate --no-timestamp --output Actual.swift SourceFiles/Struct.swift`
|
||||
Then the file "SourceFiles/Expected/Struct.swift" should be equal to file "Actual.swift"
|
||||
|
||||
# File structure tests (They reuse code from recoreded tests so if they fail these will fail because of it.)
|
||||
|
||||
Scenario: in file
|
||||
When I run `runcuckoo generate --no-timestamp --output Actual.swift SourceFiles/TestedClass.swift SourceFiles/TestedProtocol.swift`
|
||||
Then the file "Expected/GeneratedMocks.swift" should be equal to file "Actual.swift"
|
||||
|
||||
Scenario: in directory
|
||||
When I run `runcuckoo generate --no-timestamp --output . SourceFiles/ClassWithAttributes.swift SourceFiles/Imports.swift`
|
||||
Then the file "Expected/ClassWithAttributes.swift" should be equal to file "ClassWithAttributes.swift"
|
||||
And the file "Expected/Imports.swift" should be equal to file "Imports.swift"
|
||||
|
||||
Scenario: in file with file-prefix
|
||||
When I run `runcuckoo generate --no-timestamp --file-prefix Mock --output Actual.swift SourceFiles/TestedClass.swift SourceFiles/TestedProtocol.swift`
|
||||
Then the file "SourceFiles/Expected/GeneratedMocks.swift" should be equal to file "Actual.swift"
|
||||
Then the file "Expected/GeneratedMocks.swift" should be equal to file "Actual.swift"
|
||||
|
||||
Scenario: in directory with file-prefix
|
||||
When I run `runcuckoo generate --no-timestamp --file-prefix Mock --output . SourceFiles/ClassWithAttributes.swift SourceFiles/Imports.swift`
|
||||
Then the file "SourceFiles/Expected/ClassWithAttributes.swift" should be equal to file "MockClassWithAttributes.swift"
|
||||
And the file "SourceFiles/Expected/Imports.swift" should be equal to file "MockImports.swift"
|
||||
Scenario: class with init
|
||||
When I run `runcuckoo generate --no-timestamp --output Actual.swift SourceFiles/ClassWithInit.swift`
|
||||
Then the file "SourceFiles/Expected/ClassWithInit.swift" should be equal to file "Actual.swift"
|
||||
Then the file "Expected/ClassWithAttributes.swift" should be equal to file "MockClassWithAttributes.swift"
|
||||
And the file "Expected/Imports.swift" should be equal to file "MockImports.swift"
|
||||
|
|
|
@ -4,9 +4,11 @@ require 'aruba/cucumber'
|
|||
|
||||
Before do |scenario|
|
||||
%x'ln -s ../../Tests/SourceFiles ../Build/tmp/SourceFiles'
|
||||
%x'ln -s ../../Tests/SourceFiles/Expected ../Build/tmp/Expected'
|
||||
end
|
||||
|
||||
After do |scenario|
|
||||
%x'cp -R ../Build/tmp ../Build/log/"#{scenario.name}"'
|
||||
%x'rm ../Build/log/"#{scenario.name}"/SourceFiles'
|
||||
%x'rm ../Build/log/"#{scenario.name}"/Expected'
|
||||
end
|
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
./run_tests.sh "$@"
|
||||
for file in Build/log/*/*.swift; do
|
||||
fileName=$(echo "$file" | rev | cut -d"/" -f1 | rev)
|
||||
expectedFile="Tests/SourceFiles/Expected/${fileName}"
|
||||
if [ -f $expectedFile ]; then
|
||||
cp "$file" $expectedFile
|
||||
fi
|
||||
done
|
|
@ -1,6 +1,8 @@
|
|||
#!/usr/bin/env bash
|
||||
rm -rf Build
|
||||
mkdir Build
|
||||
xcodebuild -project 'CuckooGenerator.xcodeproj' -scheme 'CuckooGenerator' -configuration 'Release' CONFIGURATION_BUILD_DIR=$(pwd)/Build clean build
|
||||
if [ "$1" != "--no-build" ]; then
|
||||
rm -rf Build
|
||||
mkdir Build
|
||||
xcodebuild -project 'CuckooGenerator.xcodeproj' -scheme 'CuckooGenerator' -configuration 'Release' CONFIGURATION_BUILD_DIR=$(pwd)/Build clean build
|
||||
fi
|
||||
cd Tests
|
||||
cucumber
|
Loading…
Reference in New Issue