-
Notifications
You must be signed in to change notification settings - Fork 114
Limit the amount of value reflection data expectation checking collects by default #915
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -258,6 +258,44 @@ public struct Configuration: Sendable { | |||||
|
||||||
/// The test case filter to which test cases should be filtered when run. | ||||||
public var testCaseFilter: TestCaseFilter = { _, _ in true } | ||||||
|
||||||
// MARK: - Expectation checking | ||||||
|
||||||
/// Whether or not reflection of values in expressions checked by expectations | ||||||
/// is enabled. | ||||||
/// | ||||||
/// When the value of this property is `false`, value reflection is disabled | ||||||
stmontgomery marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
/// and values will only be represented using `String(describing:)` instead of | ||||||
/// using `Mirror` to recursively reflect their substructure. | ||||||
public var isValueReflectionEnabled: Bool = true | ||||||
stmontgomery marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
/// The maximum number of elements that can included in a single child | ||||||
/// collection when reflecting a value checked by an expectation. | ||||||
/// | ||||||
/// When ``Expression/Value/init(reflecting:)`` is reflecting a value and it | ||||||
/// encounters a child value which is a collection, it consults the value of | ||||||
/// this property and only includes the children of that collection up to this | ||||||
/// maximum count. After this maximum is reached, all subsequent elements are | ||||||
/// omitted and a single placeholder child is added indicating the number of | ||||||
/// elements which have been truncated. | ||||||
public var maximumValueReflectionCollectionCount: Int = 10 | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I like having the types of properties with There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We pretty much never do this for variables to which we assign values. We only specify types on variables that will be assigned values later. Consistency would be good (either way.) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Already merged, but I did strip off the explicit types from these properties for now, for consistency! |
||||||
|
||||||
/// The maximum depth of children that can be included in the reflection of a | ||||||
/// checked expectation value. | ||||||
/// | ||||||
/// When ``Expression/Value/init(reflecting:)`` is reflecting a value, it | ||||||
/// recursively reflects that value's children. Before doing so, it consults | ||||||
/// the value of this property to determine the maximum depth of the children | ||||||
/// to include. After this maximum depth is reached, all children at deeper | ||||||
/// levels are omitted and the ``Expression/Value/isTruncated`` property is | ||||||
/// set to `true` to reflect that the reflection is incomplete. | ||||||
/// | ||||||
/// - Note: `Optional` values contribute twice towards this maximum, since | ||||||
stmontgomery marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
/// their mirror represents the wrapped value as a child of the optional. | ||||||
/// Since optionals are common, the default value of this property is | ||||||
/// somewhat larger than it otherwise would be in an attempt to make the | ||||||
/// defaults useful for real-world tests. | ||||||
public var maximumValueReflectionChildDepth: Int = 10 | ||||||
stmontgomery marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
} | ||||||
|
||||||
// MARK: - Deprecated | ||||||
|
Uh oh!
There was an error while loading. Please reload this page.