Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Xulijie Li
MathsEngine
Commits
af571a61
Commit
af571a61
authored
May 03, 2021
by
BlackAngle233
Browse files
212
parent
1d9b5391
Changes
756
Hide whitespace changes
Inline
Side-by-side
Too many changes to show.
To preserve performance only
756 of 756+
files are displayed.
Plain diff
Email patch
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Commands/TestCommandPcHelper.cs
View file @
af571a61
using
System
;
using
System
;
using
System.Collections
;
using
System.Collections
;
namespace
UnityEngine.TestTools
namespace
UnityEngine.TestTools
{
{
internal
class
TestCommandPcHelper
internal
class
TestCommandPcHelper
{
{
public
virtual
void
SetEnumeratorPC
(
IEnumerator
enumerator
,
int
pc
)
public
virtual
void
SetEnumeratorPC
(
IEnumerator
enumerator
,
int
pc
)
{
{
// Noop implementation used in playmode.
// Noop implementation used in playmode.
}
}
public
virtual
int
GetEnumeratorPC
(
IEnumerator
enumerator
)
public
virtual
int
GetEnumeratorPC
(
IEnumerator
enumerator
)
{
{
return
0
;
return
0
;
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Commands/TestCommandPcHelper.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 33e6b78c96bb0694e96383e3c56b7b54
guid: 33e6b78c96bb0694e96383e3c56b7b54
MonoImporter:
MonoImporter:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
serializedVersion: 2
defaultReferences: []
defaultReferences: []
executionOrder: 0
executionOrder: 0
icon: {instanceID: 0}
icon: {instanceID: 0}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/ConstructDelegator.cs
View file @
af571a61
using
System
;
using
System
;
using
System.Linq
;
using
System.Linq
;
using
NUnit.Framework.Internal
;
using
NUnit.Framework.Internal
;
using
UnityEngine.TestRunner.NUnitExtensions.Runner
;
using
UnityEngine.TestRunner.NUnitExtensions.Runner
;
using
UnityEngine.TestTools.Logging
;
using
UnityEngine.TestTools.Logging
;
using
UnityEngine.TestTools.TestRunner
;
using
UnityEngine.TestTools.TestRunner
;
namespace
UnityEngine.TestTools.NUnitExtensions
namespace
UnityEngine.TestTools.NUnitExtensions
{
{
/// <summary>
/// <summary>
/// Specialization of BaseDelegator that makes sure objects are created on the MainThread.
/// Specialization of BaseDelegator that makes sure objects are created on the MainThread.
/// It also deals with ScriptableObjects so that tests can survive assembly reload.
/// It also deals with ScriptableObjects so that tests can survive assembly reload.
/// </summary>
/// </summary>
internal
class
ConstructDelegator
internal
class
ConstructDelegator
{
{
private
Type
m_RequestedType
;
private
Type
m_RequestedType
;
private
object
[]
m_Arguments
;
private
object
[]
m_Arguments
;
private
ScriptableObject
m_CurrentRunningTest
;
private
ScriptableObject
m_CurrentRunningTest
;
private
readonly
IStateSerializer
m_StateSerializer
;
private
readonly
IStateSerializer
m_StateSerializer
;
protected
Exception
m_Exception
;
protected
Exception
m_Exception
;
protected
object
m_Result
;
protected
object
m_Result
;
protected
ITestExecutionContext
m_Context
;
protected
ITestExecutionContext
m_Context
;
public
ConstructDelegator
(
IStateSerializer
stateSerializer
)
public
ConstructDelegator
(
IStateSerializer
stateSerializer
)
{
{
m_StateSerializer
=
stateSerializer
;
m_StateSerializer
=
stateSerializer
;
}
}
protected
object
HandleResult
()
protected
object
HandleResult
()
{
{
SetCurrentTestContext
();
SetCurrentTestContext
();
if
(
m_Exception
!=
null
)
if
(
m_Exception
!=
null
)
{
{
var
temp
=
m_Exception
;
var
temp
=
m_Exception
;
m_Exception
=
null
;
m_Exception
=
null
;
throw
temp
;
throw
temp
;
}
}
var
tempResult
=
m_Result
;
var
tempResult
=
m_Result
;
m_Result
=
null
;
m_Result
=
null
;
return
tempResult
;
return
tempResult
;
}
}
protected
void
SetCurrentTestContext
()
protected
void
SetCurrentTestContext
()
{
{
var
prop
=
typeof
(
UnityTestExecutionContext
).
GetProperty
(
"CurrentContext"
);
var
prop
=
typeof
(
UnityTestExecutionContext
).
GetProperty
(
"CurrentContext"
);
if
(
prop
!=
null
)
if
(
prop
!=
null
)
{
{
prop
.
SetValue
(
null
,
m_Context
,
null
);
prop
.
SetValue
(
null
,
m_Context
,
null
);
}
}
}
}
public
object
Delegate
(
Type
type
,
object
[]
arguments
)
public
object
Delegate
(
Type
type
,
object
[]
arguments
)
{
{
AssertState
();
AssertState
();
m_Context
=
UnityTestExecutionContext
.
CurrentContext
;
m_Context
=
UnityTestExecutionContext
.
CurrentContext
;
m_RequestedType
=
type
;
m_RequestedType
=
type
;
m_Arguments
=
arguments
;
m_Arguments
=
arguments
;
using
(
var
logScope
=
new
LogScope
())
using
(
var
logScope
=
new
LogScope
())
{
{
Execute
(
logScope
);
Execute
(
logScope
);
}
}
return
HandleResult
();
return
HandleResult
();
}
}
private
void
AssertState
()
private
void
AssertState
()
{
{
if
(
m_RequestedType
!=
null
)
if
(
m_RequestedType
!=
null
)
{
{
throw
new
Exception
(
"Constructor not executed yet"
);
throw
new
Exception
(
"Constructor not executed yet"
);
}
}
}
}
public
bool
HasAction
()
public
bool
HasAction
()
{
{
return
m_RequestedType
!=
null
;
return
m_RequestedType
!=
null
;
}
}
public
void
Execute
(
LogScope
logScope
)
public
void
Execute
(
LogScope
logScope
)
{
{
try
try
{
{
if
(
typeof
(
ScriptableObject
).
IsAssignableFrom
(
m_RequestedType
))
if
(
typeof
(
ScriptableObject
).
IsAssignableFrom
(
m_RequestedType
))
{
{
if
(
m_CurrentRunningTest
!=
null
&&
m_RequestedType
!=
m_CurrentRunningTest
.
GetType
())
if
(
m_CurrentRunningTest
!=
null
&&
m_RequestedType
!=
m_CurrentRunningTest
.
GetType
())
{
{
DestroyCurrentTestObjectIfExists
();
DestroyCurrentTestObjectIfExists
();
}
}
if
(
m_CurrentRunningTest
==
null
)
if
(
m_CurrentRunningTest
==
null
)
{
{
if
(
m_StateSerializer
.
CanRestoreFromScriptableObject
(
m_RequestedType
))
if
(
m_StateSerializer
.
CanRestoreFromScriptableObject
(
m_RequestedType
))
{
{
m_CurrentRunningTest
=
m_StateSerializer
.
RestoreScriptableObjectInstance
();
m_CurrentRunningTest
=
m_StateSerializer
.
RestoreScriptableObjectInstance
();
}
}
else
else
{
{
m_CurrentRunningTest
=
ScriptableObject
.
CreateInstance
(
m_RequestedType
);
m_CurrentRunningTest
=
ScriptableObject
.
CreateInstance
(
m_RequestedType
);
}
}
}
}
m_Result
=
m_CurrentRunningTest
;
m_Result
=
m_CurrentRunningTest
;
}
}
else
else
{
{
DestroyCurrentTestObjectIfExists
();
DestroyCurrentTestObjectIfExists
();
m_Result
=
Activator
.
CreateInstance
(
m_RequestedType
,
m_Arguments
);
m_Result
=
Activator
.
CreateInstance
(
m_RequestedType
,
m_Arguments
);
if
(
m_StateSerializer
.
CanRestoreFromJson
(
m_RequestedType
))
if
(
m_StateSerializer
.
CanRestoreFromJson
(
m_RequestedType
))
{
{
m_StateSerializer
.
RestoreClassFromJson
(
ref
m_Result
);
m_StateSerializer
.
RestoreClassFromJson
(
ref
m_Result
);
}
}
}
}
if
(
logScope
.
AnyFailingLogs
())
if
(
logScope
.
AnyFailingLogs
())
{
{
var
failingLog
=
logScope
.
FailingLogs
.
First
();
var
failingLog
=
logScope
.
FailingLogs
.
First
();
throw
new
UnhandledLogMessageException
(
failingLog
);
throw
new
UnhandledLogMessageException
(
failingLog
);
}
}
if
(
logScope
.
ExpectedLogs
.
Any
())
if
(
logScope
.
ExpectedLogs
.
Any
())
throw
new
UnexpectedLogMessageException
(
LogScope
.
Current
.
ExpectedLogs
.
Peek
());
throw
new
UnexpectedLogMessageException
(
LogScope
.
Current
.
ExpectedLogs
.
Peek
());
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
{
m_Exception
=
e
;
m_Exception
=
e
;
}
}
finally
finally
{
{
m_RequestedType
=
null
;
m_RequestedType
=
null
;
m_Arguments
=
null
;
m_Arguments
=
null
;
}
}
}
}
public
void
DestroyCurrentTestObjectIfExists
()
public
void
DestroyCurrentTestObjectIfExists
()
{
{
if
(
m_CurrentRunningTest
==
null
)
if
(
m_CurrentRunningTest
==
null
)
return
;
return
;
Object
.
DestroyImmediate
(
m_CurrentRunningTest
);
Object
.
DestroyImmediate
(
m_CurrentRunningTest
);
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/ConstructDelegator.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: b42e1db66fe9c634798674cb9e1df2ca
guid: b42e1db66fe9c634798674cb9e1df2ca
MonoImporter:
MonoImporter:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
serializedVersion: 2
defaultReferences: []
defaultReferences: []
executionOrder: 0
executionOrder: 0
icon: {instanceID: 0}
icon: {instanceID: 0}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Filters.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: c3de99f9efc582a48995bc8e8c2df418
guid: c3de99f9efc582a48995bc8e8c2df418
folderAsset: yes
folderAsset: yes
DefaultImporter:
DefaultImporter:
externalObjects: {}
externalObjects: {}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs
View file @
af571a61
using
System
;
using
System
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Internal.Filters
;
using
NUnit.Framework.Internal.Filters
;
namespace
UnityEngine.TestRunner.NUnitExtensions.Filters
namespace
UnityEngine.TestRunner.NUnitExtensions.Filters
{
{
internal
class
AssemblyNameFilter
:
ValueMatchFilter
internal
class
AssemblyNameFilter
:
ValueMatchFilter
{
{
public
AssemblyNameFilter
(
string
assemblyName
)
:
base
(
assemblyName
)
{}
public
AssemblyNameFilter
(
string
assemblyName
)
:
base
(
assemblyName
)
{}
public
override
bool
Match
(
ITest
test
)
public
override
bool
Match
(
ITest
test
)
{
{
string
assemblyName
=
string
.
Empty
;
string
assemblyName
=
string
.
Empty
;
//Assembly fullname is in the format "Assembly-name, meta data ...", so extract the name by looking for the comma
//Assembly fullname is in the format "Assembly-name, meta data ...", so extract the name by looking for the comma
if
(
test
.
TypeInfo
!=
null
&&
test
.
TypeInfo
.
Assembly
!=
null
&&
test
.
TypeInfo
.
FullName
!=
null
)
if
(
test
.
TypeInfo
!=
null
&&
test
.
TypeInfo
.
Assembly
!=
null
&&
test
.
TypeInfo
.
FullName
!=
null
)
assemblyName
=
test
.
TypeInfo
.
Assembly
.
FullName
.
Substring
(
0
,
test
.
TypeInfo
.
Assembly
.
FullName
.
IndexOf
(
','
)).
TrimEnd
(
','
);
assemblyName
=
test
.
TypeInfo
.
Assembly
.
FullName
.
Substring
(
0
,
test
.
TypeInfo
.
Assembly
.
FullName
.
IndexOf
(
','
)).
TrimEnd
(
','
);
return
ExpectedValue
.
Equals
(
assemblyName
,
StringComparison
.
OrdinalIgnoreCase
);
return
ExpectedValue
.
Equals
(
assemblyName
,
StringComparison
.
OrdinalIgnoreCase
);
}
}
protected
override
string
ElementName
protected
override
string
ElementName
{
{
get
{
return
"id"
;
}
get
{
return
"id"
;
}
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Filters/AssemblyNameFilter.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 91319408591cec1478efd3c62f9f418a
guid: 91319408591cec1478efd3c62f9f418a
MonoImporter:
MonoImporter:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
serializedVersion: 2
defaultReferences: []
defaultReferences: []
executionOrder: 0
executionOrder: 0
icon: {instanceID: 0}
icon: {instanceID: 0}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs
View file @
af571a61
using
System.Collections
;
using
System.Collections
;
using
System.Linq
;
using
System.Linq
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Internal
;
using
NUnit.Framework.Internal
;
using
NUnit.Framework.Internal.Filters
;
using
NUnit.Framework.Internal.Filters
;
namespace
UnityEngine.TestRunner.NUnitExtensions.Filters
namespace
UnityEngine.TestRunner.NUnitExtensions.Filters
{
{
internal
class
CategoryFilterExtended
:
CategoryFilter
internal
class
CategoryFilterExtended
:
CategoryFilter
{
{
public
static
string
k_DefaultCategory
=
"Uncategorized"
;
public
static
string
k_DefaultCategory
=
"Uncategorized"
;
public
CategoryFilterExtended
(
string
name
)
:
base
(
name
)
public
CategoryFilterExtended
(
string
name
)
:
base
(
name
)
{
{
}
}
public
override
bool
Match
(
ITest
test
)
public
override
bool
Match
(
ITest
test
)
{
{
IList
testCategories
=
test
.
Properties
[
PropertyNames
.
Category
].
Cast
<
string
>().
ToList
();
IList
testCategories
=
test
.
Properties
[
PropertyNames
.
Category
].
Cast
<
string
>().
ToList
();
if
(
test
is
TestMethod
)
if
(
test
is
TestMethod
)
{
{
// Do not count tests with no attribute as Uncategorized if test fixture class has at least one attribute
// Do not count tests with no attribute as Uncategorized if test fixture class has at least one attribute
// The test inherits the attribute from the test fixture
// The test inherits the attribute from the test fixture
IList
fixtureCategories
=
test
.
Parent
.
Properties
[
PropertyNames
.
Category
].
Cast
<
string
>().
ToList
();
IList
fixtureCategories
=
test
.
Parent
.
Properties
[
PropertyNames
.
Category
].
Cast
<
string
>().
ToList
();
if
(
fixtureCategories
.
Count
>
0
)
if
(
fixtureCategories
.
Count
>
0
)
return
false
;
return
false
;
}
}
if
(
testCategories
.
Count
==
0
&&
ExpectedValue
==
k_DefaultCategory
&&
test
is
TestMethod
)
if
(
testCategories
.
Count
==
0
&&
ExpectedValue
==
k_DefaultCategory
&&
test
is
TestMethod
)
return
true
;
return
true
;
return
base
.
Match
(
test
);
return
base
.
Match
(
test
);
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Filters/CategoryFilterExtended.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: ebeedaa04bb53e24ba2e7fb6745e3fd3
guid: ebeedaa04bb53e24ba2e7fb6745e3fd3
MonoImporter:
MonoImporter:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
serializedVersion: 2
defaultReferences: []
defaultReferences: []
executionOrder: 0
executionOrder: 0
icon: {instanceID: 0}
icon: {instanceID: 0}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/IAsyncTestAssemblyBuilder.cs
View file @
af571a61
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Reflection
;
using
System.Reflection
;
using
NUnit.Framework.Api
;
using
NUnit.Framework.Api
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Interfaces
;
namespace
UnityEngine.TestTools.NUnitExtensions
namespace
UnityEngine.TestTools.NUnitExtensions
{
{
internal
interface
IAsyncTestAssemblyBuilder
:
ITestAssemblyBuilder
internal
interface
IAsyncTestAssemblyBuilder
:
ITestAssemblyBuilder
{
{
IEnumerator
<
ITest
>
BuildAsync
(
Assembly
[]
assemblies
,
TestPlatform
[]
testPlatforms
,
IDictionary
<
string
,
object
>
options
);
IEnumerator
<
ITest
>
BuildAsync
(
Assembly
[]
assemblies
,
TestPlatform
[]
testPlatforms
,
IDictionary
<
string
,
object
>
options
);
}
}
}
}
\ No newline at end of file
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/IAsyncTestAssemblyBuilder.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: c3aa5c3d59b94854e843f10b75b3ad63
guid: c3aa5c3d59b94854e843f10b75b3ad63
MonoImporter:
MonoImporter:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
serializedVersion: 2
defaultReferences: []
defaultReferences: []
executionOrder: 0
executionOrder: 0
icon: {instanceID: 0}
icon: {instanceID: 0}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/IStateSerializer.cs
View file @
af571a61
using
System
;
using
System
;
namespace
UnityEngine.TestTools.NUnitExtensions
namespace
UnityEngine.TestTools.NUnitExtensions
{
{
internal
interface
IStateSerializer
internal
interface
IStateSerializer
{
{
ScriptableObject
RestoreScriptableObjectInstance
();
ScriptableObject
RestoreScriptableObjectInstance
();
void
RestoreClassFromJson
(
ref
object
instance
);
void
RestoreClassFromJson
(
ref
object
instance
);
bool
CanRestoreFromJson
(
Type
requestedType
);
bool
CanRestoreFromJson
(
Type
requestedType
);
bool
CanRestoreFromScriptableObject
(
Type
requestedType
);
bool
CanRestoreFromScriptableObject
(
Type
requestedType
);
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/IStateSerializer.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 5f875a14565308a40a5262d2504da705
guid: 5f875a14565308a40a5262d2504da705
MonoImporter:
MonoImporter:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
serializedVersion: 2
defaultReferences: []
defaultReferences: []
executionOrder: 0
executionOrder: 0
icon: {instanceID: 0}
icon: {instanceID: 0}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Runner.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 37888acc09d9ee848bf9559f06645c45
guid: 37888acc09d9ee848bf9559f06645c45
folderAsset: yes
folderAsset: yes
DefaultImporter:
DefaultImporter:
externalObjects: {}
externalObjects: {}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs
View file @
af571a61
using
System
;
using
System
;
using
System.Collections
;
using
System.Collections
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Reflection
;
using
System.Reflection
;
using
NUnit.Framework
;
using
NUnit.Framework
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Internal
;
using
NUnit.Framework.Internal
;
using
NUnit.Framework.Internal.Commands
;
using
NUnit.Framework.Internal.Commands
;
using
NUnit.Framework.Internal.Execution
;
using
NUnit.Framework.Internal.Execution
;
using
UnityEngine.TestTools.Logging
;
using
UnityEngine.TestTools.Logging
;
using
UnityEngine.TestTools.TestRunner
;
using
UnityEngine.TestTools.TestRunner
;
namespace
UnityEngine.TestRunner.NUnitExtensions.Runner
namespace
UnityEngine.TestRunner.NUnitExtensions.Runner
{
{
internal
class
CompositeWorkItem
:
UnityWorkItem
internal
class
CompositeWorkItem
:
UnityWorkItem
{
{
private
readonly
TestSuite
_suite
;
private
readonly
TestSuite
_suite
;
private
readonly
TestSuiteResult
_suiteResult
;
private
readonly
TestSuiteResult
_suiteResult
;
private
readonly
ITestFilter
_childFilter
;
private
readonly
ITestFilter
_childFilter
;
private
TestCommand
_setupCommand
;
private
TestCommand
_setupCommand
;
private
TestCommand
_teardownCommand
;
private
TestCommand
_teardownCommand
;
public
List
<
UnityWorkItem
>
Children
{
get
;
private
set
;
}
public
List
<
UnityWorkItem
>
Children
{
get
;
private
set
;
}
private
int
_countOrder
;
private
int
_countOrder
;
private
CountdownEvent
_childTestCountdown
;
private
CountdownEvent
_childTestCountdown
;
public
CompositeWorkItem
(
TestSuite
suite
,
ITestFilter
childFilter
,
WorkItemFactory
factory
)
public
CompositeWorkItem
(
TestSuite
suite
,
ITestFilter
childFilter
,
WorkItemFactory
factory
)
:
base
(
suite
,
factory
)
:
base
(
suite
,
factory
)
{
{
_suite
=
suite
;
_suite
=
suite
;
_suiteResult
=
Result
as
TestSuiteResult
;
_suiteResult
=
Result
as
TestSuiteResult
;
_childFilter
=
childFilter
;
_childFilter
=
childFilter
;
_countOrder
=
0
;
_countOrder
=
0
;
}
}
protected
override
IEnumerable
PerformWork
()
protected
override
IEnumerable
PerformWork
()
{
{
InitializeSetUpAndTearDownCommands
();
InitializeSetUpAndTearDownCommands
();
if
(
UnityTestExecutionContext
.
CurrentContext
!=
null
&&
m_DontRunRestoringResult
&&
EditModeTestCallbacks
.
RestoringTestContext
!=
null
)
if
(
UnityTestExecutionContext
.
CurrentContext
!=
null
&&
m_DontRunRestoringResult
&&
EditModeTestCallbacks
.
RestoringTestContext
!=
null
)
{
{
EditModeTestCallbacks
.
RestoringTestContext
();
EditModeTestCallbacks
.
RestoringTestContext
();
}
}
if
(!
CheckForCancellation
())
if
(!
CheckForCancellation
())
if
(
Test
.
RunState
==
RunState
.
Explicit
&&
!
_childFilter
.
IsExplicitMatch
(
Test
))
if
(
Test
.
RunState
==
RunState
.
Explicit
&&
!
_childFilter
.
IsExplicitMatch
(
Test
))
SkipFixture
(
ResultState
.
Explicit
,
GetSkipReason
(),
null
);
SkipFixture
(
ResultState
.
Explicit
,
GetSkipReason
(),
null
);
else
else
switch
(
Test
.
RunState
)
switch
(
Test
.
RunState
)
{
{
default
:
default
:
case
RunState
.
Runnable
:
case
RunState
.
Runnable
:
case
RunState
.
Explicit
:
case
RunState
.
Explicit
:
Result
.
SetResult
(
ResultState
.
Success
);
Result
.
SetResult
(
ResultState
.
Success
);
CreateChildWorkItems
();
CreateChildWorkItems
();
if
(
Children
.
Count
>
0
)
if
(
Children
.
Count
>
0
)
{
{
if
(!
m_DontRunRestoringResult
)
if
(!
m_DontRunRestoringResult
)
{
{
//This is needed to give the editor a chance to go out of playmode if needed before creating objects.
//This is needed to give the editor a chance to go out of playmode if needed before creating objects.
//If we do not, the objects could be automatically destroyed when exiting playmode and could result in errors later on
//If we do not, the objects could be automatically destroyed when exiting playmode and could result in errors later on
yield
return
null
;
yield
return
null
;
PerformOneTimeSetUp
();
PerformOneTimeSetUp
();
}
}
if
(!
CheckForCancellation
())
if
(!
CheckForCancellation
())
{
{
switch
(
Result
.
ResultState
.
Status
)
switch
(
Result
.
ResultState
.
Status
)
{
{
case
TestStatus
.
Passed
:
case
TestStatus
.
Passed
:
foreach
(
var
child
in
RunChildren
())
foreach
(
var
child
in
RunChildren
())
{
{
if
(
CheckForCancellation
())
if
(
CheckForCancellation
())
{
{
yield
break
;
yield
break
;
}
}
yield
return
child
;
yield
return
child
;
}
}
break
;
break
;
case
TestStatus
.
Skipped
:
case
TestStatus
.
Skipped
:
case
TestStatus
.
Inconclusive
:
case
TestStatus
.
Inconclusive
:
case
TestStatus
.
Failed
:
case
TestStatus
.
Failed
:
SkipChildren
(
_suite
,
Result
.
ResultState
.
WithSite
(
FailureSite
.
Parent
),
"OneTimeSetUp: "
+
Result
.
Message
);
SkipChildren
(
_suite
,
Result
.
ResultState
.
WithSite
(
FailureSite
.
Parent
),
"OneTimeSetUp: "
+
Result
.
Message
);
break
;
break
;
}
}
}
}
if
(
Context
.
ExecutionStatus
!=
TestExecutionStatus
.
AbortRequested
&&
!
m_DontRunRestoringResult
)
if
(
Context
.
ExecutionStatus
!=
TestExecutionStatus
.
AbortRequested
&&
!
m_DontRunRestoringResult
)
{
{
PerformOneTimeTearDown
();
PerformOneTimeTearDown
();
}
}
}
}
break
;
break
;
case
RunState
.
Skipped
:
case
RunState
.
Skipped
:
SkipFixture
(
ResultState
.
Skipped
,
GetSkipReason
(),
null
);
SkipFixture
(
ResultState
.
Skipped
,
GetSkipReason
(),
null
);
break
;
break
;
case
RunState
.
Ignored
:
case
RunState
.
Ignored
:
SkipFixture
(
ResultState
.
Ignored
,
GetSkipReason
(),
null
);
SkipFixture
(
ResultState
.
Ignored
,
GetSkipReason
(),
null
);
break
;
break
;
case
RunState
.
NotRunnable
:
case
RunState
.
NotRunnable
:
SkipFixture
(
ResultState
.
NotRunnable
,
GetSkipReason
(),
GetProviderStackTrace
());
SkipFixture
(
ResultState
.
NotRunnable
,
GetSkipReason
(),
GetProviderStackTrace
());
break
;
break
;
}
}
if
(!
ResultedInDomainReload
)
if
(!
ResultedInDomainReload
)
{
{
WorkItemComplete
();
WorkItemComplete
();
}
}
}
}
private
bool
CheckForCancellation
()
private
bool
CheckForCancellation
()
{
{
if
(
Context
.
ExecutionStatus
!=
TestExecutionStatus
.
Running
)
if
(
Context
.
ExecutionStatus
!=
TestExecutionStatus
.
Running
)
{
{
Result
.
SetResult
(
ResultState
.
Cancelled
,
"Test cancelled by user"
);
Result
.
SetResult
(
ResultState
.
Cancelled
,
"Test cancelled by user"
);
return
true
;
return
true
;
}
}
return
false
;
return
false
;
}
}
private
void
InitializeSetUpAndTearDownCommands
()
private
void
InitializeSetUpAndTearDownCommands
()
{
{
List
<
SetUpTearDownItem
>
setUpTearDownItems
=
_suite
.
TypeInfo
!=
null
List
<
SetUpTearDownItem
>
setUpTearDownItems
=
_suite
.
TypeInfo
!=
null
?
CommandBuilder
.
BuildSetUpTearDownList
(
_suite
.
TypeInfo
.
Type
,
typeof
(
OneTimeSetUpAttribute
),
typeof
(
OneTimeTearDownAttribute
))
?
CommandBuilder
.
BuildSetUpTearDownList
(
_suite
.
TypeInfo
.
Type
,
typeof
(
OneTimeSetUpAttribute
),
typeof
(
OneTimeTearDownAttribute
))
:
new
List
<
SetUpTearDownItem
>();
:
new
List
<
SetUpTearDownItem
>();
var
actionItems
=
new
List
<
TestActionItem
>();
var
actionItems
=
new
List
<
TestActionItem
>();
foreach
(
ITestAction
action
in
Actions
)
foreach
(
ITestAction
action
in
Actions
)
{
{
bool
applyToSuite
=
(
action
.
Targets
&
ActionTargets
.
Suite
)
==
ActionTargets
.
Suite
bool
applyToSuite
=
(
action
.
Targets
&
ActionTargets
.
Suite
)
==
ActionTargets
.
Suite
||
action
.
Targets
==
ActionTargets
.
Default
&&
!(
Test
is
ParameterizedMethodSuite
);
||
action
.
Targets
==
ActionTargets
.
Default
&&
!(
Test
is
ParameterizedMethodSuite
);
bool
applyToTest
=
(
action
.
Targets
&
ActionTargets
.
Test
)
==
ActionTargets
.
Test
bool
applyToTest
=
(
action
.
Targets
&
ActionTargets
.
Test
)
==
ActionTargets
.
Test
&&
!(
Test
is
ParameterizedMethodSuite
);
&&
!(
Test
is
ParameterizedMethodSuite
);
if
(
applyToSuite
)
if
(
applyToSuite
)
actionItems
.
Add
(
new
TestActionItem
(
action
));
actionItems
.
Add
(
new
TestActionItem
(
action
));
if
(
applyToTest
)
if
(
applyToTest
)
Context
.
UpstreamActions
.
Add
(
action
);
Context
.
UpstreamActions
.
Add
(
action
);
}
}
_setupCommand
=
CommandBuilder
.
MakeOneTimeSetUpCommand
(
_suite
,
setUpTearDownItems
,
actionItems
);
_setupCommand
=
CommandBuilder
.
MakeOneTimeSetUpCommand
(
_suite
,
setUpTearDownItems
,
actionItems
);
_teardownCommand
=
CommandBuilder
.
MakeOneTimeTearDownCommand
(
_suite
,
setUpTearDownItems
,
actionItems
);
_teardownCommand
=
CommandBuilder
.
MakeOneTimeTearDownCommand
(
_suite
,
setUpTearDownItems
,
actionItems
);
}
}
private
void
PerformOneTimeSetUp
()
private
void
PerformOneTimeSetUp
()
{
{
var
logScope
=
new
LogScope
();
var
logScope
=
new
LogScope
();
try
try
{
{
_setupCommand
.
Execute
(
Context
);
_setupCommand
.
Execute
(
Context
);
}
}
catch
(
Exception
ex
)
catch
(
Exception
ex
)
{
{
if
(
ex
is
NUnitException
||
ex
is
TargetInvocationException
)
if
(
ex
is
NUnitException
||
ex
is
TargetInvocationException
)
ex
=
ex
.
InnerException
;
ex
=
ex
.
InnerException
;
Result
.
RecordException
(
ex
,
FailureSite
.
SetUp
);
Result
.
RecordException
(
ex
,
FailureSite
.
SetUp
);
}
}
if
(
logScope
.
AnyFailingLogs
())
if
(
logScope
.
AnyFailingLogs
())
{
{
Result
.
RecordException
(
new
UnhandledLogMessageException
(
logScope
.
FailingLogs
.
First
()));
Result
.
RecordException
(
new
UnhandledLogMessageException
(
logScope
.
FailingLogs
.
First
()));
}
}
logScope
.
Dispose
();
logScope
.
Dispose
();
}
}
private
IEnumerable
RunChildren
()
private
IEnumerable
RunChildren
()
{
{
int
childCount
=
Children
.
Count
;
int
childCount
=
Children
.
Count
;
if
(
childCount
==
0
)
if
(
childCount
==
0
)
throw
new
InvalidOperationException
(
"RunChildren called but item has no children"
);
throw
new
InvalidOperationException
(
"RunChildren called but item has no children"
);
_childTestCountdown
=
new
CountdownEvent
(
childCount
);
_childTestCountdown
=
new
CountdownEvent
(
childCount
);
foreach
(
UnityWorkItem
child
in
Children
)
foreach
(
UnityWorkItem
child
in
Children
)
{
{
if
(
CheckForCancellation
())
if
(
CheckForCancellation
())
{
{
yield
break
;
yield
break
;
}
}
var
unityTestExecutionContext
=
new
UnityTestExecutionContext
(
Context
);
var
unityTestExecutionContext
=
new
UnityTestExecutionContext
(
Context
);
child
.
InitializeContext
(
unityTestExecutionContext
);
child
.
InitializeContext
(
unityTestExecutionContext
);
var
enumerable
=
child
.
Execute
().
GetEnumerator
();
var
enumerable
=
child
.
Execute
().
GetEnumerator
();
while
(
true
)
while
(
true
)
{
{
if
(!
enumerable
.
MoveNext
())
if
(!
enumerable
.
MoveNext
())
{
{
break
;
break
;
}
}
ResultedInDomainReload
|=
child
.
ResultedInDomainReload
;
ResultedInDomainReload
|=
child
.
ResultedInDomainReload
;
yield
return
enumerable
.
Current
;
yield
return
enumerable
.
Current
;
}
}
_suiteResult
.
AddResult
(
child
.
Result
);
_suiteResult
.
AddResult
(
child
.
Result
);
childCount
--;
childCount
--;
}
}
if
(
childCount
>
0
)
if
(
childCount
>
0
)
{
{
while
(
childCount
--
>
0
)
while
(
childCount
--
>
0
)
CountDownChildTest
();
CountDownChildTest
();
}
}
}
}
private
void
CreateChildWorkItems
()
private
void
CreateChildWorkItems
()
{
{
Children
=
new
List
<
UnityWorkItem
>();
Children
=
new
List
<
UnityWorkItem
>();
var
testSuite
=
_suite
;
var
testSuite
=
_suite
;
foreach
(
ITest
test
in
testSuite
.
Tests
)
foreach
(
ITest
test
in
testSuite
.
Tests
)
{
{
if
(
_childFilter
.
Pass
(
test
))
if
(
_childFilter
.
Pass
(
test
))
{
{
var
child
=
m_Factory
.
Create
(
test
,
_childFilter
);
var
child
=
m_Factory
.
Create
(
test
,
_childFilter
);
if
(
test
.
Properties
.
ContainsKey
(
PropertyNames
.
Order
))
if
(
test
.
Properties
.
ContainsKey
(
PropertyNames
.
Order
))
{
{
Children
.
Insert
(
0
,
child
);
Children
.
Insert
(
0
,
child
);
_countOrder
++;
_countOrder
++;
}
}
else
else
{
{
Children
.
Add
(
child
);
Children
.
Add
(
child
);
}
}
}
}
}
}
if
(
_countOrder
!=
0
)
SortChildren
();
if
(
_countOrder
!=
0
)
SortChildren
();
}
}
private
class
UnityWorkItemOrderComparer
:
IComparer
<
UnityWorkItem
>
private
class
UnityWorkItemOrderComparer
:
IComparer
<
UnityWorkItem
>
{
{
public
int
Compare
(
UnityWorkItem
x
,
UnityWorkItem
y
)
public
int
Compare
(
UnityWorkItem
x
,
UnityWorkItem
y
)
{
{
var
xKey
=
int
.
MaxValue
;
var
xKey
=
int
.
MaxValue
;
var
yKey
=
int
.
MaxValue
;
var
yKey
=
int
.
MaxValue
;
if
(
x
.
Test
.
Properties
.
ContainsKey
(
PropertyNames
.
Order
))
if
(
x
.
Test
.
Properties
.
ContainsKey
(
PropertyNames
.
Order
))
xKey
=
(
int
)
x
.
Test
.
Properties
[
PropertyNames
.
Order
][
0
];
xKey
=
(
int
)
x
.
Test
.
Properties
[
PropertyNames
.
Order
][
0
];
if
(
y
.
Test
.
Properties
.
ContainsKey
(
PropertyNames
.
Order
))
if
(
y
.
Test
.
Properties
.
ContainsKey
(
PropertyNames
.
Order
))
yKey
=
(
int
)
y
.
Test
.
Properties
[
PropertyNames
.
Order
][
0
];
yKey
=
(
int
)
y
.
Test
.
Properties
[
PropertyNames
.
Order
][
0
];
return
xKey
.
CompareTo
(
yKey
);
return
xKey
.
CompareTo
(
yKey
);
}
}
}
}
private
void
SortChildren
()
private
void
SortChildren
()
{
{
Children
.
Sort
(
0
,
_countOrder
,
new
UnityWorkItemOrderComparer
());
Children
.
Sort
(
0
,
_countOrder
,
new
UnityWorkItemOrderComparer
());
}
}
private
void
SkipFixture
(
ResultState
resultState
,
string
message
,
string
stackTrace
)
private
void
SkipFixture
(
ResultState
resultState
,
string
message
,
string
stackTrace
)
{
{
Result
.
SetResult
(
resultState
.
WithSite
(
FailureSite
.
SetUp
),
message
,
StackFilter
.
Filter
(
stackTrace
));
Result
.
SetResult
(
resultState
.
WithSite
(
FailureSite
.
SetUp
),
message
,
StackFilter
.
Filter
(
stackTrace
));
SkipChildren
(
_suite
,
resultState
.
WithSite
(
FailureSite
.
Parent
),
"OneTimeSetUp: "
+
message
);
SkipChildren
(
_suite
,
resultState
.
WithSite
(
FailureSite
.
Parent
),
"OneTimeSetUp: "
+
message
);
}
}
private
void
SkipChildren
(
TestSuite
suite
,
ResultState
resultState
,
string
message
)
private
void
SkipChildren
(
TestSuite
suite
,
ResultState
resultState
,
string
message
)
{
{
foreach
(
Test
child
in
suite
.
Tests
)
foreach
(
Test
child
in
suite
.
Tests
)
{
{
if
(
_childFilter
.
Pass
(
child
))
if
(
_childFilter
.
Pass
(
child
))
{
{
Context
.
Listener
.
TestStarted
(
child
);
Context
.
Listener
.
TestStarted
(
child
);
TestResult
childResult
=
child
.
MakeTestResult
();
TestResult
childResult
=
child
.
MakeTestResult
();
childResult
.
SetResult
(
resultState
,
message
);
childResult
.
SetResult
(
resultState
,
message
);
_suiteResult
.
AddResult
(
childResult
);
_suiteResult
.
AddResult
(
childResult
);
if
(
child
.
IsSuite
)
if
(
child
.
IsSuite
)
SkipChildren
((
TestSuite
)
child
,
resultState
,
message
);
SkipChildren
((
TestSuite
)
child
,
resultState
,
message
);
Context
.
Listener
.
TestFinished
(
childResult
);
Context
.
Listener
.
TestFinished
(
childResult
);
}
}
}
}
}
}
private
void
PerformOneTimeTearDown
()
private
void
PerformOneTimeTearDown
()
{
{
_teardownCommand
.
Execute
(
Context
);
_teardownCommand
.
Execute
(
Context
);
}
}
private
string
GetSkipReason
()
private
string
GetSkipReason
()
{
{
return
(
string
)
Test
.
Properties
.
Get
(
PropertyNames
.
SkipReason
);
return
(
string
)
Test
.
Properties
.
Get
(
PropertyNames
.
SkipReason
);
}
}
private
string
GetProviderStackTrace
()
private
string
GetProviderStackTrace
()
{
{
return
(
string
)
Test
.
Properties
.
Get
(
PropertyNames
.
ProviderStackTrace
);
return
(
string
)
Test
.
Properties
.
Get
(
PropertyNames
.
ProviderStackTrace
);
}
}
private
void
CountDownChildTest
()
private
void
CountDownChildTest
()
{
{
_childTestCountdown
.
Signal
();
_childTestCountdown
.
Signal
();
if
(
_childTestCountdown
.
CurrentCount
==
0
)
if
(
_childTestCountdown
.
CurrentCount
==
0
)
{
{
if
(
Context
.
ExecutionStatus
!=
TestExecutionStatus
.
AbortRequested
)
if
(
Context
.
ExecutionStatus
!=
TestExecutionStatus
.
AbortRequested
)
PerformOneTimeTearDown
();
PerformOneTimeTearDown
();
foreach
(
var
childResult
in
_suiteResult
.
Children
)
foreach
(
var
childResult
in
_suiteResult
.
Children
)
if
(
childResult
.
ResultState
==
ResultState
.
Cancelled
)
if
(
childResult
.
ResultState
==
ResultState
.
Cancelled
)
{
{
this
.
Result
.
SetResult
(
ResultState
.
Cancelled
,
"Cancelled by user"
);
this
.
Result
.
SetResult
(
ResultState
.
Cancelled
,
"Cancelled by user"
);
break
;
break
;
}
}
WorkItemComplete
();
WorkItemComplete
();
}
}
}
}
public
override
void
Cancel
(
bool
force
)
public
override
void
Cancel
(
bool
force
)
{
{
if
(
Children
==
null
)
if
(
Children
==
null
)
return
;
return
;
foreach
(
var
child
in
Children
)
foreach
(
var
child
in
Children
)
{
{
var
ctx
=
child
.
Context
;
var
ctx
=
child
.
Context
;
if
(
ctx
!=
null
)
if
(
ctx
!=
null
)
ctx
.
ExecutionStatus
=
force
?
TestExecutionStatus
.
AbortRequested
:
TestExecutionStatus
.
StopRequested
;
ctx
.
ExecutionStatus
=
force
?
TestExecutionStatus
.
AbortRequested
:
TestExecutionStatus
.
StopRequested
;
if
(
child
.
State
==
WorkItemState
.
Running
)
if
(
child
.
State
==
WorkItemState
.
Running
)
child
.
Cancel
(
force
);
child
.
Cancel
(
force
);
}
}
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Runner/CompositeWorkItem.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 110d5035a36a6a34580fb65bb40cd78f
guid: 110d5035a36a6a34580fb65bb40cd78f
MonoImporter:
MonoImporter:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
serializedVersion: 2
defaultReferences: []
defaultReferences: []
executionOrder: 0
executionOrder: 0
icon: {instanceID: 0}
icon: {instanceID: 0}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs
View file @
af571a61
using
System
;
using
System
;
using
System.Collections
;
using
System.Collections
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Internal
;
using
NUnit.Framework.Internal
;
using
NUnit.Framework.Internal.Commands
;
using
NUnit.Framework.Internal.Commands
;
using
NUnit.Framework.Internal.Execution
;
using
NUnit.Framework.Internal.Execution
;
using
UnityEngine.TestTools.Utils
;
using
UnityEngine.TestTools.Utils
;
namespace
UnityEngine.TestRunner.NUnitExtensions.Runner
namespace
UnityEngine.TestRunner.NUnitExtensions.Runner
{
{
internal
class
CoroutineTestWorkItem
:
UnityWorkItem
internal
class
CoroutineTestWorkItem
:
UnityWorkItem
{
{
private
static
MonoBehaviour
m_MonoBehaviourCoroutineRunner
;
private
static
MonoBehaviour
m_MonoBehaviourCoroutineRunner
;
private
TestCommand
m_Command
;
private
TestCommand
m_Command
;
public
static
MonoBehaviour
monoBehaviourCoroutineRunner
public
static
MonoBehaviour
monoBehaviourCoroutineRunner
{
{
get
get
{
{
if
(
m_MonoBehaviourCoroutineRunner
==
null
)
if
(
m_MonoBehaviourCoroutineRunner
==
null
)
{
{
throw
new
NullReferenceException
(
"MonoBehaviour coroutine runner not set"
);
throw
new
NullReferenceException
(
"MonoBehaviour coroutine runner not set"
);
}
}
return
m_MonoBehaviourCoroutineRunner
;
return
m_MonoBehaviourCoroutineRunner
;
}
}
set
{
m_MonoBehaviourCoroutineRunner
=
value
;
}
set
{
m_MonoBehaviourCoroutineRunner
=
value
;
}
}
}
public
CoroutineTestWorkItem
(
TestMethod
test
,
ITestFilter
filter
)
public
CoroutineTestWorkItem
(
TestMethod
test
,
ITestFilter
filter
)
:
base
(
test
,
null
)
:
base
(
test
,
null
)
{
{
m_Command
=
m_Command
=
TestCommandBuilder
.
BuildTestCommand
(
test
,
filter
);
m_Command
=
m_Command
=
TestCommandBuilder
.
BuildTestCommand
(
test
,
filter
);
}
}
protected
override
IEnumerable
PerformWork
()
protected
override
IEnumerable
PerformWork
()
{
{
if
(
m_Command
is
SkipCommand
)
if
(
m_Command
is
SkipCommand
)
{
{
m_Command
.
Execute
(
Context
);
m_Command
.
Execute
(
Context
);
Result
=
Context
.
CurrentResult
;
Result
=
Context
.
CurrentResult
;
WorkItemComplete
();
WorkItemComplete
();
yield
break
;
yield
break
;
}
}
if
(
m_Command
is
ApplyChangesToContextCommand
)
if
(
m_Command
is
ApplyChangesToContextCommand
)
{
{
var
applyChangesToContextCommand
=
(
ApplyChangesToContextCommand
)
m_Command
;
var
applyChangesToContextCommand
=
(
ApplyChangesToContextCommand
)
m_Command
;
applyChangesToContextCommand
.
ApplyChanges
(
Context
);
applyChangesToContextCommand
.
ApplyChanges
(
Context
);
m_Command
=
applyChangesToContextCommand
.
GetInnerCommand
();
m_Command
=
applyChangesToContextCommand
.
GetInnerCommand
();
}
}
var
enumerableTestMethodCommand
=
(
IEnumerableTestMethodCommand
)
m_Command
;
var
enumerableTestMethodCommand
=
(
IEnumerableTestMethodCommand
)
m_Command
;
try
try
{
{
var
executeEnumerable
=
enumerableTestMethodCommand
.
ExecuteEnumerable
(
Context
).
GetEnumerator
();
var
executeEnumerable
=
enumerableTestMethodCommand
.
ExecuteEnumerable
(
Context
).
GetEnumerator
();
var
coroutineRunner
=
new
CoroutineRunner
(
monoBehaviourCoroutineRunner
,
Context
);
var
coroutineRunner
=
new
CoroutineRunner
(
monoBehaviourCoroutineRunner
,
Context
);
yield
return
coroutineRunner
.
HandleEnumerableTest
(
executeEnumerable
);
yield
return
coroutineRunner
.
HandleEnumerableTest
(
executeEnumerable
);
if
(
coroutineRunner
.
HasFailedWithTimeout
())
if
(
coroutineRunner
.
HasFailedWithTimeout
())
{
{
Context
.
CurrentResult
.
SetResult
(
ResultState
.
Failure
,
string
.
Format
(
"Test exceeded Timeout value of {0}ms"
,
Context
.
TestCaseTimeout
));
Context
.
CurrentResult
.
SetResult
(
ResultState
.
Failure
,
string
.
Format
(
"Test exceeded Timeout value of {0}ms"
,
Context
.
TestCaseTimeout
));
}
}
while
(
executeEnumerable
.
MoveNext
())
{}
while
(
executeEnumerable
.
MoveNext
())
{}
Result
=
Context
.
CurrentResult
;
Result
=
Context
.
CurrentResult
;
}
}
finally
finally
{
{
WorkItemComplete
();
WorkItemComplete
();
}
}
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Runner/CoroutineTestWorkItem.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: b557515fff172984e8c4400b43f1c631
guid: b557515fff172984e8c4400b43f1c631
MonoImporter:
MonoImporter:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
serializedVersion: 2
defaultReferences: []
defaultReferences: []
executionOrder: 0
executionOrder: 0
icon: {instanceID: 0}
icon: {instanceID: 0}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs
View file @
af571a61
using
System
;
using
System
;
using
System.Collections
;
using
System.Collections
;
using
System.Linq
;
using
System.Linq
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Internal
;
using
NUnit.Framework.Internal
;
using
NUnit.Framework.Internal.Commands
;
using
NUnit.Framework.Internal.Commands
;
using
NUnit.Framework.Internal.Execution
;
using
NUnit.Framework.Internal.Execution
;
using
UnityEngine.TestTools
;
using
UnityEngine.TestTools
;
using
SetUpTearDownCommand
=
NUnit
.
Framework
.
Internal
.
Commands
.
SetUpTearDownCommand
;
using
SetUpTearDownCommand
=
NUnit
.
Framework
.
Internal
.
Commands
.
SetUpTearDownCommand
;
using
TestActionCommand
=
NUnit
.
Framework
.
Internal
.
Commands
.
TestActionCommand
;
using
TestActionCommand
=
NUnit
.
Framework
.
Internal
.
Commands
.
TestActionCommand
;
namespace
UnityEngine.TestRunner.NUnitExtensions.Runner
namespace
UnityEngine.TestRunner.NUnitExtensions.Runner
{
{
internal
class
EditModeTestCallbacks
internal
class
EditModeTestCallbacks
{
{
public
static
Action
RestoringTestContext
{
get
;
set
;
}
public
static
Action
RestoringTestContext
{
get
;
set
;
}
}
}
internal
class
DefaultTestWorkItem
:
UnityWorkItem
internal
class
DefaultTestWorkItem
:
UnityWorkItem
{
{
private
TestCommand
_command
;
private
TestCommand
_command
;
public
DefaultTestWorkItem
(
TestMethod
test
,
ITestFilter
filter
)
public
DefaultTestWorkItem
(
TestMethod
test
,
ITestFilter
filter
)
:
base
(
test
,
null
)
:
base
(
test
,
null
)
{
{
_command
=
TestCommandBuilder
.
BuildTestCommand
(
test
,
filter
);
_command
=
TestCommandBuilder
.
BuildTestCommand
(
test
,
filter
);
}
}
protected
override
IEnumerable
PerformWork
()
protected
override
IEnumerable
PerformWork
()
{
{
if
(
m_DontRunRestoringResult
&&
EditModeTestCallbacks
.
RestoringTestContext
!=
null
)
if
(
m_DontRunRestoringResult
&&
EditModeTestCallbacks
.
RestoringTestContext
!=
null
)
{
{
EditModeTestCallbacks
.
RestoringTestContext
();
EditModeTestCallbacks
.
RestoringTestContext
();
Result
=
Context
.
CurrentResult
;
Result
=
Context
.
CurrentResult
;
yield
break
;
yield
break
;
}
}
try
try
{
{
if
(
_command
is
SkipCommand
||
_command
is
FailCommand
)
if
(
_command
is
SkipCommand
||
_command
is
FailCommand
)
{
{
Result
=
_command
.
Execute
(
Context
);
Result
=
_command
.
Execute
(
Context
);
yield
break
;
yield
break
;
}
}
if
(!(
_command
is
IEnumerableTestMethodCommand
))
if
(!(
_command
is
IEnumerableTestMethodCommand
))
{
{
Debug
.
LogError
(
"Cannot perform work on "
+
_command
.
GetType
().
Name
);
Debug
.
LogError
(
"Cannot perform work on "
+
_command
.
GetType
().
Name
);
yield
break
;
yield
break
;
}
}
foreach
(
var
workItemStep
in
((
IEnumerableTestMethodCommand
)
_command
).
ExecuteEnumerable
(
Context
))
foreach
(
var
workItemStep
in
((
IEnumerableTestMethodCommand
)
_command
).
ExecuteEnumerable
(
Context
))
{
{
ResultedInDomainReload
=
false
;
ResultedInDomainReload
=
false
;
if
(
workItemStep
is
IEditModeTestYieldInstruction
)
if
(
workItemStep
is
IEditModeTestYieldInstruction
)
{
{
var
editModeTestYieldInstruction
=
(
IEditModeTestYieldInstruction
)
workItemStep
;
var
editModeTestYieldInstruction
=
(
IEditModeTestYieldInstruction
)
workItemStep
;
yield
return
editModeTestYieldInstruction
;
yield
return
editModeTestYieldInstruction
;
var
enumerator
=
editModeTestYieldInstruction
.
Perform
();
var
enumerator
=
editModeTestYieldInstruction
.
Perform
();
while
(
true
)
while
(
true
)
{
{
bool
moveNext
;
bool
moveNext
;
try
try
{
{
moveNext
=
enumerator
.
MoveNext
();
moveNext
=
enumerator
.
MoveNext
();
}
}
catch
(
Exception
e
)
catch
(
Exception
e
)
{
{
Context
.
CurrentResult
.
RecordException
(
e
);
Context
.
CurrentResult
.
RecordException
(
e
);
break
;
break
;
}
}
if
(!
moveNext
)
if
(!
moveNext
)
{
{
break
;
break
;
}
}
yield
return
null
;
yield
return
null
;
}
}
}
}
else
else
{
{
yield
return
workItemStep
;
yield
return
workItemStep
;
}
}
}
}
Result
=
Context
.
CurrentResult
;
Result
=
Context
.
CurrentResult
;
}
}
finally
finally
{
{
WorkItemComplete
();
WorkItemComplete
();
}
}
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/Runner/DefaultTestWorkItem.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: c7cfda246e604b945b12b7afedb094ce
guid: c7cfda246e604b945b12b7afedb094ce
MonoImporter:
MonoImporter:
externalObjects: {}
externalObjects: {}
serializedVersion: 2
serializedVersion: 2
defaultReferences: []
defaultReferences: []
executionOrder: 0
executionOrder: 0
icon: {instanceID: 0}
icon: {instanceID: 0}
userData:
userData:
assetBundleName:
assetBundleName:
assetBundleVariant:
assetBundleVariant:
Prev
1
…
31
32
33
34
35
36
37
38
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment