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/Assertions/LogScope.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: b1d8465ba1376b148bdab58965101f47
guid: b1d8465ba1376b148bdab58965101f47
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/Assertions/LogScope/ILogScope.cs
View file @
af571a61
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
namespace
UnityEngine.TestTools.Logging
namespace
UnityEngine.TestTools.Logging
{
{
internal
interface
ILogScope
:
IDisposable
internal
interface
ILogScope
:
IDisposable
{
{
Queue
<
LogMatch
>
ExpectedLogs
{
get
;
set
;
}
Queue
<
LogMatch
>
ExpectedLogs
{
get
;
set
;
}
List
<
LogEvent
>
AllLogs
{
get
;
}
List
<
LogEvent
>
AllLogs
{
get
;
}
List
<
LogEvent
>
FailingLogs
{
get
;
}
List
<
LogEvent
>
FailingLogs
{
get
;
}
bool
IgnoreFailingMessages
{
get
;
set
;
}
bool
IgnoreFailingMessages
{
get
;
set
;
}
bool
IsNUnitException
{
get
;
}
bool
IsNUnitException
{
get
;
}
bool
IsNUnitSuccessException
{
get
;
}
bool
IsNUnitSuccessException
{
get
;
}
bool
IsNUnitInconclusiveException
{
get
;
}
bool
IsNUnitInconclusiveException
{
get
;
}
bool
IsNUnitIgnoreException
{
get
;
}
bool
IsNUnitIgnoreException
{
get
;
}
string
NUnitExceptionMessage
{
get
;
}
string
NUnitExceptionMessage
{
get
;
}
void
AddLog
(
string
message
,
string
stacktrace
,
LogType
type
);
void
AddLog
(
string
message
,
string
stacktrace
,
LogType
type
);
bool
AnyFailingLogs
();
bool
AnyFailingLogs
();
void
ProcessExpectedLogs
();
void
ProcessExpectedLogs
();
void
NoUnexpectedReceived
();
void
NoUnexpectedReceived
();
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/Assertions/LogScope/ILogScope.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 3504aa04cda851b44a65973f9aead6f7
guid: 3504aa04cda851b44a65973f9aead6f7
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/Assertions/LogScope/LogEvent.cs
View file @
af571a61
namespace
UnityEngine.TestTools.Logging
namespace
UnityEngine.TestTools.Logging
{
{
internal
class
LogEvent
internal
class
LogEvent
{
{
public
string
Message
{
get
;
set
;
}
public
string
Message
{
get
;
set
;
}
public
string
StackTrace
{
get
;
set
;
}
public
string
StackTrace
{
get
;
set
;
}
public
LogType
LogType
{
get
;
set
;
}
public
LogType
LogType
{
get
;
set
;
}
public
bool
IsHandled
{
get
;
set
;
}
public
bool
IsHandled
{
get
;
set
;
}
public
override
string
ToString
()
public
override
string
ToString
()
{
{
return
string
.
Format
(
"[{0}] {1}"
,
LogType
,
Message
);
return
string
.
Format
(
"[{0}] {1}"
,
LogType
,
Message
);
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/Assertions/LogScope/LogEvent.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 0c56471f08a0f6846afc792f0b4205b9
guid: 0c56471f08a0f6846afc792f0b4205b9
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/Assertions/LogScope/LogMatch.cs
View file @
af571a61
using
System
;
using
System
;
using
System.Text.RegularExpressions
;
using
System.Text.RegularExpressions
;
namespace
UnityEngine.TestTools.Logging
namespace
UnityEngine.TestTools.Logging
{
{
[
Serializable
]
[
Serializable
]
internal
class
LogMatch
internal
class
LogMatch
{
{
[
SerializeField
]
[
SerializeField
]
private
bool
m_UseRegex
;
private
bool
m_UseRegex
;
[
SerializeField
]
[
SerializeField
]
private
string
m_Message
;
private
string
m_Message
;
[
SerializeField
]
[
SerializeField
]
private
string
m_MessageRegex
;
private
string
m_MessageRegex
;
[
SerializeField
]
[
SerializeField
]
private
string
m_LogType
;
private
string
m_LogType
;
public
string
Message
public
string
Message
{
{
get
{
return
m_Message
;
}
get
{
return
m_Message
;
}
set
set
{
{
m_Message
=
value
;
m_Message
=
value
;
m_UseRegex
=
false
;
m_UseRegex
=
false
;
}
}
}
}
public
Regex
MessageRegex
public
Regex
MessageRegex
{
{
get
get
{
{
if
(!
m_UseRegex
)
if
(!
m_UseRegex
)
{
{
return
null
;
return
null
;
}
}
return
new
Regex
(
m_MessageRegex
);
return
new
Regex
(
m_MessageRegex
);
}
}
set
set
{
{
if
(
value
!=
null
)
if
(
value
!=
null
)
{
{
m_MessageRegex
=
value
.
ToString
();
m_MessageRegex
=
value
.
ToString
();
m_UseRegex
=
true
;
m_UseRegex
=
true
;
}
}
else
else
{
{
m_MessageRegex
=
null
;
m_MessageRegex
=
null
;
m_UseRegex
=
false
;
m_UseRegex
=
false
;
}
}
}
}
}
}
public
LogType
?
LogType
public
LogType
?
LogType
{
{
get
get
{
{
if
(!
string
.
IsNullOrEmpty
(
m_LogType
))
if
(!
string
.
IsNullOrEmpty
(
m_LogType
))
{
{
return
Enum
.
Parse
(
typeof
(
LogType
),
m_LogType
)
as
LogType
?
;
return
Enum
.
Parse
(
typeof
(
LogType
),
m_LogType
)
as
LogType
?
;
}
}
return
null
;
return
null
;
}
}
set
set
{
{
if
(
value
!=
null
)
if
(
value
!=
null
)
{
{
m_LogType
=
value
.
Value
.
ToString
();
m_LogType
=
value
.
Value
.
ToString
();
}
}
else
else
{
{
m_LogType
=
null
;
m_LogType
=
null
;
}
}
}
}
}
}
public
bool
Matches
(
LogEvent
log
)
public
bool
Matches
(
LogEvent
log
)
{
{
if
(
LogType
!=
null
&&
LogType
!=
log
.
LogType
)
if
(
LogType
!=
null
&&
LogType
!=
log
.
LogType
)
{
{
return
false
;
return
false
;
}
}
if
(
m_UseRegex
)
if
(
m_UseRegex
)
{
{
return
MessageRegex
.
IsMatch
(
log
.
Message
);
return
MessageRegex
.
IsMatch
(
log
.
Message
);
}
}
else
else
{
{
return
Message
.
Equals
(
log
.
Message
);
return
Message
.
Equals
(
log
.
Message
);
}
}
}
}
public
override
string
ToString
()
public
override
string
ToString
()
{
{
if
(
m_UseRegex
)
if
(
m_UseRegex
)
return
string
.
Format
(
"[{0}] Regex: {1}"
,
LogType
,
MessageRegex
);
return
string
.
Format
(
"[{0}] Regex: {1}"
,
LogType
,
MessageRegex
);
else
else
return
string
.
Format
(
"[{0}] {1}"
,
LogType
,
Message
);
return
string
.
Format
(
"[{0}] {1}"
,
LogType
,
Message
);
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/Assertions/LogScope/LogMatch.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 9945ffed4692c6044b6d3acf81efd694
guid: 9945ffed4692c6044b6d3acf81efd694
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/Assertions/LogScope/LogScope.cs
View file @
af571a61
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
UnityEngine.TestTools.TestRunner
;
using
UnityEngine.TestTools.TestRunner
;
namespace
UnityEngine.TestTools.Logging
namespace
UnityEngine.TestTools.Logging
{
{
sealed
class
LogScope
:
ILogScope
sealed
class
LogScope
:
ILogScope
{
{
static
List
<
LogScope
>
s_ActiveScopes
=
new
List
<
LogScope
>();
static
List
<
LogScope
>
s_ActiveScopes
=
new
List
<
LogScope
>();
readonly
object
m_Lock
=
new
object
();
readonly
object
m_Lock
=
new
object
();
bool
m_Disposed
;
bool
m_Disposed
;
bool
m_NeedToProcessLogs
;
bool
m_NeedToProcessLogs
;
public
Queue
<
LogMatch
>
ExpectedLogs
{
get
;
set
;
}
public
Queue
<
LogMatch
>
ExpectedLogs
{
get
;
set
;
}
public
List
<
LogEvent
>
AllLogs
{
get
;
}
public
List
<
LogEvent
>
AllLogs
{
get
;
}
public
List
<
LogEvent
>
FailingLogs
{
get
;
}
public
List
<
LogEvent
>
FailingLogs
{
get
;
}
public
bool
IgnoreFailingMessages
{
get
;
set
;
}
public
bool
IgnoreFailingMessages
{
get
;
set
;
}
public
bool
IsNUnitException
{
get
;
private
set
;
}
public
bool
IsNUnitException
{
get
;
private
set
;
}
public
bool
IsNUnitSuccessException
{
get
;
private
set
;
}
public
bool
IsNUnitSuccessException
{
get
;
private
set
;
}
public
bool
IsNUnitInconclusiveException
{
get
;
private
set
;
}
public
bool
IsNUnitInconclusiveException
{
get
;
private
set
;
}
public
bool
IsNUnitIgnoreException
{
get
;
private
set
;
}
public
bool
IsNUnitIgnoreException
{
get
;
private
set
;
}
public
string
NUnitExceptionMessage
{
get
;
private
set
;
}
public
string
NUnitExceptionMessage
{
get
;
private
set
;
}
public
static
LogScope
Current
public
static
LogScope
Current
{
{
get
get
{
{
if
(
s_ActiveScopes
.
Count
==
0
)
if
(
s_ActiveScopes
.
Count
==
0
)
throw
new
InvalidOperationException
(
"No log scope is available"
);
throw
new
InvalidOperationException
(
"No log scope is available"
);
return
s_ActiveScopes
[
0
];
return
s_ActiveScopes
[
0
];
}
}
}
}
public
static
bool
HasCurrentLogScope
()
public
static
bool
HasCurrentLogScope
()
{
{
return
s_ActiveScopes
.
Count
>
0
;
return
s_ActiveScopes
.
Count
>
0
;
}
}
public
LogScope
()
public
LogScope
()
{
{
AllLogs
=
new
List
<
LogEvent
>();
AllLogs
=
new
List
<
LogEvent
>();
FailingLogs
=
new
List
<
LogEvent
>();
FailingLogs
=
new
List
<
LogEvent
>();
ExpectedLogs
=
new
Queue
<
LogMatch
>();
ExpectedLogs
=
new
Queue
<
LogMatch
>();
IgnoreFailingMessages
=
false
;
IgnoreFailingMessages
=
false
;
Activate
();
Activate
();
}
}
void
Activate
()
void
Activate
()
{
{
s_ActiveScopes
.
Insert
(
0
,
this
);
s_ActiveScopes
.
Insert
(
0
,
this
);
RegisterScope
(
this
);
RegisterScope
(
this
);
Application
.
logMessageReceivedThreaded
-=
AddLog
;
Application
.
logMessageReceivedThreaded
-=
AddLog
;
Application
.
logMessageReceivedThreaded
+=
AddLog
;
Application
.
logMessageReceivedThreaded
+=
AddLog
;
}
}
void
Deactivate
()
void
Deactivate
()
{
{
Application
.
logMessageReceivedThreaded
-=
AddLog
;
Application
.
logMessageReceivedThreaded
-=
AddLog
;
s_ActiveScopes
.
Remove
(
this
);
s_ActiveScopes
.
Remove
(
this
);
UnregisterScope
(
this
);
UnregisterScope
(
this
);
}
}
static
void
RegisterScope
(
LogScope
logScope
)
static
void
RegisterScope
(
LogScope
logScope
)
{
{
Application
.
logMessageReceivedThreaded
+=
logScope
.
AddLog
;
Application
.
logMessageReceivedThreaded
+=
logScope
.
AddLog
;
}
}
static
void
UnregisterScope
(
LogScope
logScope
)
static
void
UnregisterScope
(
LogScope
logScope
)
{
{
Application
.
logMessageReceivedThreaded
-=
logScope
.
AddLog
;
Application
.
logMessageReceivedThreaded
-=
logScope
.
AddLog
;
}
}
public
void
AddLog
(
string
message
,
string
stacktrace
,
LogType
type
)
public
void
AddLog
(
string
message
,
string
stacktrace
,
LogType
type
)
{
{
lock
(
m_Lock
)
lock
(
m_Lock
)
{
{
m_NeedToProcessLogs
=
true
;
m_NeedToProcessLogs
=
true
;
var
log
=
new
LogEvent
var
log
=
new
LogEvent
{
{
LogType
=
type
,
LogType
=
type
,
Message
=
message
,
Message
=
message
,
StackTrace
=
stacktrace
,
StackTrace
=
stacktrace
,
};
};
AllLogs
.
Add
(
log
);
AllLogs
.
Add
(
log
);
if
(
IsNUnitResultStateException
(
stacktrace
,
type
))
if
(
IsNUnitResultStateException
(
stacktrace
,
type
))
{
{
if
(
message
.
StartsWith
(
"SuccessException"
))
if
(
message
.
StartsWith
(
"SuccessException"
))
{
{
IsNUnitException
=
true
;
IsNUnitException
=
true
;
IsNUnitSuccessException
=
true
;
IsNUnitSuccessException
=
true
;
if
(
message
.
StartsWith
(
"SuccessException: "
))
if
(
message
.
StartsWith
(
"SuccessException: "
))
{
{
NUnitExceptionMessage
=
message
.
Substring
(
"SuccessException: "
.
Length
);
NUnitExceptionMessage
=
message
.
Substring
(
"SuccessException: "
.
Length
);
return
;
return
;
}
}
}
}
else
if
(
message
.
StartsWith
(
"InconclusiveException"
))
else
if
(
message
.
StartsWith
(
"InconclusiveException"
))
{
{
IsNUnitException
=
true
;
IsNUnitException
=
true
;
IsNUnitInconclusiveException
=
true
;
IsNUnitInconclusiveException
=
true
;
if
(
message
.
StartsWith
(
"InconclusiveException: "
))
if
(
message
.
StartsWith
(
"InconclusiveException: "
))
{
{
NUnitExceptionMessage
=
message
.
Substring
(
"InconclusiveException: "
.
Length
);
NUnitExceptionMessage
=
message
.
Substring
(
"InconclusiveException: "
.
Length
);
return
;
return
;
}
}
}
}
else
if
(
message
.
StartsWith
(
"IgnoreException"
))
else
if
(
message
.
StartsWith
(
"IgnoreException"
))
{
{
IsNUnitException
=
true
;
IsNUnitException
=
true
;
IsNUnitIgnoreException
=
true
;
IsNUnitIgnoreException
=
true
;
if
(
message
.
StartsWith
(
"IgnoreException: "
))
if
(
message
.
StartsWith
(
"IgnoreException: "
))
{
{
NUnitExceptionMessage
=
message
.
Substring
(
"IgnoreException: "
.
Length
);
NUnitExceptionMessage
=
message
.
Substring
(
"IgnoreException: "
.
Length
);
return
;
return
;
}
}
}
}
}
}
if
(
IsFailingLog
(
type
)
&&
!
IgnoreFailingMessages
)
if
(
IsFailingLog
(
type
)
&&
!
IgnoreFailingMessages
)
{
{
FailingLogs
.
Add
(
log
);
FailingLogs
.
Add
(
log
);
}
}
}
}
}
}
static
bool
IsNUnitResultStateException
(
string
stacktrace
,
LogType
logType
)
static
bool
IsNUnitResultStateException
(
string
stacktrace
,
LogType
logType
)
{
{
if
(
logType
!=
LogType
.
Exception
)
if
(
logType
!=
LogType
.
Exception
)
return
false
;
return
false
;
return
string
.
IsNullOrEmpty
(
stacktrace
)
||
stacktrace
.
StartsWith
(
"NUnit.Framework.Assert."
);
return
string
.
IsNullOrEmpty
(
stacktrace
)
||
stacktrace
.
StartsWith
(
"NUnit.Framework.Assert."
);
}
}
static
bool
IsFailingLog
(
LogType
type
)
static
bool
IsFailingLog
(
LogType
type
)
{
{
switch
(
type
)
switch
(
type
)
{
{
case
LogType
.
Assert
:
case
LogType
.
Assert
:
case
LogType
.
Error
:
case
LogType
.
Error
:
case
LogType
.
Exception
:
case
LogType
.
Exception
:
return
true
;
return
true
;
default
:
default
:
return
false
;
return
false
;
}
}
}
}
public
void
Dispose
()
public
void
Dispose
()
{
{
Dispose
(
true
);
Dispose
(
true
);
GC
.
SuppressFinalize
(
this
);
GC
.
SuppressFinalize
(
this
);
}
}
void
Dispose
(
bool
disposing
)
void
Dispose
(
bool
disposing
)
{
{
if
(
m_Disposed
)
if
(
m_Disposed
)
{
{
return
;
return
;
}
}
m_Disposed
=
true
;
m_Disposed
=
true
;
if
(
disposing
)
if
(
disposing
)
{
{
Deactivate
();
Deactivate
();
}
}
}
}
public
bool
AnyFailingLogs
()
public
bool
AnyFailingLogs
()
{
{
ProcessExpectedLogs
();
ProcessExpectedLogs
();
return
FailingLogs
.
Any
();
return
FailingLogs
.
Any
();
}
}
public
void
ProcessExpectedLogs
()
public
void
ProcessExpectedLogs
()
{
{
lock
(
m_Lock
)
lock
(
m_Lock
)
{
{
if
(!
m_NeedToProcessLogs
||
!
ExpectedLogs
.
Any
())
if
(!
m_NeedToProcessLogs
||
!
ExpectedLogs
.
Any
())
return
;
return
;
LogMatch
expectedLog
=
null
;
LogMatch
expectedLog
=
null
;
foreach
(
var
logEvent
in
AllLogs
)
foreach
(
var
logEvent
in
AllLogs
)
{
{
if
(!
ExpectedLogs
.
Any
())
if
(!
ExpectedLogs
.
Any
())
break
;
break
;
if
(
expectedLog
==
null
&&
ExpectedLogs
.
Any
())
if
(
expectedLog
==
null
&&
ExpectedLogs
.
Any
())
expectedLog
=
ExpectedLogs
.
Peek
();
expectedLog
=
ExpectedLogs
.
Peek
();
if
(
expectedLog
!=
null
&&
expectedLog
.
Matches
(
logEvent
))
if
(
expectedLog
!=
null
&&
expectedLog
.
Matches
(
logEvent
))
{
{
ExpectedLogs
.
Dequeue
();
ExpectedLogs
.
Dequeue
();
logEvent
.
IsHandled
=
true
;
logEvent
.
IsHandled
=
true
;
if
(
FailingLogs
.
Any
(
expectedLog
.
Matches
))
if
(
FailingLogs
.
Any
(
expectedLog
.
Matches
))
{
{
var
failingLog
=
FailingLogs
.
First
(
expectedLog
.
Matches
);
var
failingLog
=
FailingLogs
.
First
(
expectedLog
.
Matches
);
FailingLogs
.
Remove
(
failingLog
);
FailingLogs
.
Remove
(
failingLog
);
}
}
expectedLog
=
null
;
expectedLog
=
null
;
}
}
}
}
m_NeedToProcessLogs
=
false
;
m_NeedToProcessLogs
=
false
;
}
}
}
}
public
void
NoUnexpectedReceived
()
public
void
NoUnexpectedReceived
()
{
{
lock
(
m_Lock
)
lock
(
m_Lock
)
{
{
ProcessExpectedLogs
();
ProcessExpectedLogs
();
var
unhandledLog
=
AllLogs
.
FirstOrDefault
(
x
=>
!
x
.
IsHandled
);
var
unhandledLog
=
AllLogs
.
FirstOrDefault
(
x
=>
!
x
.
IsHandled
);
if
(
unhandledLog
!=
null
)
if
(
unhandledLog
!=
null
)
{
{
throw
new
UnhandledLogMessageException
(
unhandledLog
);
throw
new
UnhandledLogMessageException
(
unhandledLog
);
}
}
}
}
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/Assertions/LogScope/LogScope.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 4bbc17b35884fdf468e4b52ae4222882
guid: 4bbc17b35884fdf468e4b52ae4222882
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/Assertions/UnexpectedLogMessageException.cs
View file @
af571a61
using
NUnit.Framework
;
using
NUnit.Framework
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Interfaces
;
using
UnityEngine.TestTools.Logging
;
using
UnityEngine.TestTools.Logging
;
namespace
UnityEngine.TestTools.TestRunner
namespace
UnityEngine.TestTools.TestRunner
{
{
internal
class
UnexpectedLogMessageException
:
ResultStateException
internal
class
UnexpectedLogMessageException
:
ResultStateException
{
{
public
LogMatch
LogEvent
;
public
LogMatch
LogEvent
;
public
UnexpectedLogMessageException
(
LogMatch
log
)
public
UnexpectedLogMessageException
(
LogMatch
log
)
:
base
(
BuildMessage
(
log
))
:
base
(
BuildMessage
(
log
))
{
{
LogEvent
=
log
;
LogEvent
=
log
;
}
}
private
static
string
BuildMessage
(
LogMatch
log
)
private
static
string
BuildMessage
(
LogMatch
log
)
{
{
return
string
.
Format
(
"Expected log did not appear: {0}"
,
log
);
return
string
.
Format
(
"Expected log did not appear: {0}"
,
log
);
}
}
public
override
ResultState
ResultState
public
override
ResultState
ResultState
{
{
get
{
return
ResultState
.
Failure
;
}
get
{
return
ResultState
.
Failure
;
}
}
}
public
override
string
StackTrace
{
get
{
return
null
;
}
}
public
override
string
StackTrace
{
get
{
return
null
;
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/Assertions/UnexpectedLogMessageException.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 5b2eeca598284bd4abb4a15c30df1576
guid: 5b2eeca598284bd4abb4a15c30df1576
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/Assertions/UnhandledLogMessageException.cs
View file @
af571a61
using
NUnit.Framework
;
using
NUnit.Framework
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Interfaces
;
using
UnityEngine.TestTools.Logging
;
using
UnityEngine.TestTools.Logging
;
using
UnityEngine.TestTools.Utils
;
using
UnityEngine.TestTools.Utils
;
namespace
UnityEngine.TestTools.TestRunner
namespace
UnityEngine.TestTools.TestRunner
{
{
internal
class
UnhandledLogMessageException
:
ResultStateException
internal
class
UnhandledLogMessageException
:
ResultStateException
{
{
public
LogEvent
LogEvent
;
public
LogEvent
LogEvent
;
private
readonly
string
m_CustomStackTrace
;
private
readonly
string
m_CustomStackTrace
;
public
UnhandledLogMessageException
(
LogEvent
log
)
public
UnhandledLogMessageException
(
LogEvent
log
)
:
base
(
BuildMessage
(
log
))
:
base
(
BuildMessage
(
log
))
{
{
LogEvent
=
log
;
LogEvent
=
log
;
m_CustomStackTrace
=
StackTraceFilter
.
Filter
(
log
.
StackTrace
);
m_CustomStackTrace
=
StackTraceFilter
.
Filter
(
log
.
StackTrace
);
}
}
private
static
string
BuildMessage
(
LogEvent
log
)
private
static
string
BuildMessage
(
LogEvent
log
)
{
{
return
string
.
Format
(
"Unhandled log message: '{0}'. Use UnityEngine.TestTools.LogAssert.Expect"
,
log
);
return
string
.
Format
(
"Unhandled log message: '{0}'. Use UnityEngine.TestTools.LogAssert.Expect"
,
log
);
}
}
public
override
ResultState
ResultState
public
override
ResultState
ResultState
{
{
get
{
return
ResultState
.
Failure
;
}
get
{
return
ResultState
.
Failure
;
}
}
}
public
override
string
StackTrace
public
override
string
StackTrace
{
{
get
{
return
m_CustomStackTrace
;
}
get
{
return
m_CustomStackTrace
;
}
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/Assertions/UnhandledLogMessageException.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: a8ed4063f2beecd41a234a582202f3c4
guid: a8ed4063f2beecd41a234a582202f3c4
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/Assertions/UnityTestTimeoutException.cs
View file @
af571a61
using
NUnit.Framework
;
using
NUnit.Framework
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Interfaces
;
namespace
UnityEngine.TestTools.TestRunner
namespace
UnityEngine.TestTools.TestRunner
{
{
internal
class
UnityTestTimeoutException
:
ResultStateException
internal
class
UnityTestTimeoutException
:
ResultStateException
{
{
public
UnityTestTimeoutException
(
int
timeout
)
public
UnityTestTimeoutException
(
int
timeout
)
:
base
(
BuildMessage
(
timeout
))
:
base
(
BuildMessage
(
timeout
))
{
{
}
}
private
static
string
BuildMessage
(
int
timeout
)
private
static
string
BuildMessage
(
int
timeout
)
{
{
return
string
.
Format
(
"UnityTest exceeded Timeout value of {0}ms"
,
timeout
);
return
string
.
Format
(
"UnityTest exceeded Timeout value of {0}ms"
,
timeout
);
}
}
public
override
ResultState
ResultState
public
override
ResultState
ResultState
{
{
get
{
return
ResultState
.
Failure
;
}
get
{
return
ResultState
.
Failure
;
}
}
}
public
override
string
StackTrace
public
override
string
StackTrace
{
{
get
{
return
""
;
}
get
{
return
""
;
}
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/Assertions/UnityTestTimeoutException.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: ffb335140c799c4408411d81789fb05c
guid: ffb335140c799c4408411d81789fb05c
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.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 3e8d6af343b383544ba5743d119f4062
guid: 3e8d6af343b383544ba5743d119f4062
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/ActionDelegator.cs
View file @
af571a61
using
System
;
using
System
;
using
System.Linq
;
using
System.Linq
;
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>
/// This class delegates actions from the NUnit thread that should be executed on the main thread.
/// This class delegates actions from the NUnit thread that should be executed on the main thread.
/// NUnit thread calls Delegate which blocks the execution on the thread until the action is executed.
/// NUnit thread calls Delegate which blocks the execution on the thread until the action is executed.
/// The main thread will poll for awaiting actions (HasAction) and invoke them (Execute).
/// The main thread will poll for awaiting actions (HasAction) and invoke them (Execute).
/// Once the action is executed, the main thread releases the lock and executino on the NUnit thread is continued.
/// Once the action is executed, the main thread releases the lock and executino on the NUnit thread is continued.
/// </summary>
/// </summary>
internal
class
ActionDelegator
:
BaseDelegator
internal
class
ActionDelegator
:
BaseDelegator
{
{
private
Func
<
object
>
m_Action
;
private
Func
<
object
>
m_Action
;
public
object
Delegate
(
Action
action
)
public
object
Delegate
(
Action
action
)
{
{
return
Delegate
(()
=>
{
action
();
return
null
;
});
return
Delegate
(()
=>
{
action
();
return
null
;
});
}
}
public
object
Delegate
(
Func
<
object
>
action
)
public
object
Delegate
(
Func
<
object
>
action
)
{
{
if
(
m_Aborted
)
if
(
m_Aborted
)
{
{
return
null
;
return
null
;
}
}
AssertState
();
AssertState
();
m_Context
=
UnityTestExecutionContext
.
CurrentContext
;
m_Context
=
UnityTestExecutionContext
.
CurrentContext
;
m_Signal
.
Reset
();
m_Signal
.
Reset
();
m_Action
=
action
;
m_Action
=
action
;
WaitForSignal
();
WaitForSignal
();
return
HandleResult
();
return
HandleResult
();
}
}
private
void
AssertState
()
private
void
AssertState
()
{
{
if
(
m_Action
!=
null
)
if
(
m_Action
!=
null
)
{
{
throw
new
Exception
(
"Action not executed yet"
);
throw
new
Exception
(
"Action not executed yet"
);
}
}
}
}
public
bool
HasAction
()
public
bool
HasAction
()
{
{
return
m_Action
!=
null
;
return
m_Action
!=
null
;
}
}
public
void
Execute
(
LogScope
logScope
)
public
void
Execute
(
LogScope
logScope
)
{
{
try
try
{
{
SetCurrentTestContext
();
SetCurrentTestContext
();
m_Result
=
m_Action
();
m_Result
=
m_Action
();
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_Action
=
null
;
m_Action
=
null
;
m_Signal
.
Set
();
m_Signal
.
Set
();
}
}
}
}
}
}
}
}
MathTec/Library/PackageCache/com.unity.test-framework@1.1.14/UnityEngine.TestRunner/NUnitExtensions/ActionDelegator.cs.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 4f939b9e23a0946439b812551e07ac81
guid: 4f939b9e23a0946439b812551e07ac81
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/Attributes.meta
View file @
af571a61
fileFormatVersion: 2
fileFormatVersion: 2
guid: 0cb14878543cf3d4f8472b15f7ecf0e3
guid: 0cb14878543cf3d4f8472b15f7ecf0e3
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/Attributes/ConditionalIgnoreAttribute.cs
View file @
af571a61
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
NUnit.Framework
;
using
NUnit.Framework
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Interfaces
;
using
NUnit.Framework.Internal
;
using
NUnit.Framework.Internal
;
namespace
UnityEngine.TestTools
namespace
UnityEngine.TestTools
{
{
public
class
ConditionalIgnoreAttribute
:
NUnitAttribute
,
IApplyToTest
public
class
ConditionalIgnoreAttribute
:
NUnitAttribute
,
IApplyToTest
{
{
string
m_ConditionKey
;
string
m_ConditionKey
;
string
m_IgnoreReason
;
string
m_IgnoreReason
;
public
ConditionalIgnoreAttribute
(
string
conditionKey
,
string
ignoreReason
)
public
ConditionalIgnoreAttribute
(
string
conditionKey
,
string
ignoreReason
)
{
{
m_ConditionKey
=
conditionKey
;
m_ConditionKey
=
conditionKey
;
m_IgnoreReason
=
ignoreReason
;
m_IgnoreReason
=
ignoreReason
;
}
}
public
void
ApplyToTest
(
Test
test
)
public
void
ApplyToTest
(
Test
test
)
{
{
var
key
=
m_ConditionKey
.
ToLowerInvariant
();
var
key
=
m_ConditionKey
.
ToLowerInvariant
();
if
(
m_ConditionMap
.
ContainsKey
(
key
)
&&
m_ConditionMap
[
key
])
if
(
m_ConditionMap
.
ContainsKey
(
key
)
&&
m_ConditionMap
[
key
])
{
{
test
.
RunState
=
RunState
.
Ignored
;
test
.
RunState
=
RunState
.
Ignored
;
string
skipReason
=
string
.
Format
(
m_IgnoreReason
);
string
skipReason
=
string
.
Format
(
m_IgnoreReason
);
test
.
Properties
.
Add
(
PropertyNames
.
SkipReason
,
skipReason
);
test
.
Properties
.
Add
(
PropertyNames
.
SkipReason
,
skipReason
);
}
}
}
}
static
Dictionary
<
string
,
bool
>
m_ConditionMap
=
new
Dictionary
<
string
,
bool
>();
static
Dictionary
<
string
,
bool
>
m_ConditionMap
=
new
Dictionary
<
string
,
bool
>();
public
static
void
AddConditionalIgnoreMapping
(
string
key
,
bool
value
)
public
static
void
AddConditionalIgnoreMapping
(
string
key
,
bool
value
)
{
{
m_ConditionMap
.
Add
(
key
.
ToLowerInvariant
(),
value
);
m_ConditionMap
.
Add
(
key
.
ToLowerInvariant
(),
value
);
}
}
}
}
}
}
\ No newline at end of file
Prev
1
…
28
29
30
31
32
33
34
35
36
…
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