Skip to content

Commit 7e41b6a

Browse files
committed
0.8.0
1 parent 2a4a1e1 commit 7e41b6a

21 files changed

Lines changed: 34 additions & 220 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## 0.x
44

5+
## 0.8.0
6+
* Remove `displayName` and `displayNameLength`
7+
* Remove deprecated `DEFAULT_TEST_NAME_MAX_LEN`
8+
59
### 0.7.0 - 0.7.1
610
* treat varags of `Pair<String,*>` the same as `Map<String,*>` in data-driven tests
711
* TestBalloon 0.8.2

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ This project consists of the following modules:
8686

8787
| TestBalloon Addons | TestBalloon |
8888
|--------------------|-----------------------------|
89-
| `0.7.0` - `0.7.1` | `0.8.2+` (Kotlin `2.3.0`) |
89+
| `0.7.0` - `0.8.0` | `0.8.2+` (Kotlin `2.3.0+`) |
9090
| `0.7.0-RC` | `0.8.0-RC` (Kotlin `2.3.0`) |
9191
| `0.1.1``0.6.1` | `0.7.1` (Kotlin `2.2.21`) |
9292
| `0.1.0` | `0.7.0` (Kotlin `2.2.21`) |
@@ -105,19 +105,18 @@ This project consists of the following modules:
105105
All modules allow setting global defaults with regard to test name truncation. These properties are called:
106106

107107
* `defaultTestNameLength`
108-
* `defaultDisplayNameLength`
109108

110109
The former generally defaults to 64 characters (15 on Android). Display names are not truncated by default.
111110

112111
Both properties can be set in two ways:
113112
* **globally** (e.g., `TestBalloonAddons.defaultTestNameLength = 15`)
114-
* **per test style** (e.g., `FreeSpec.defaultTestNameLength = 10`, `PropertyTest.defaultDisplayNameLength = 100`)
113+
* **per test style** (e.g., `FreeSpec.defaultTestNameLength = 10`)
115114

116115
Per-style configuration takes precedence over global configuration. Hence, per-style configuration property setters are nullable,
117116
**even though their getters will never return null**, as they fall back to the global configuration properties automatically.
118117

119-
It is also possible to set test name length and display name length for individual tests by passing the `maxLength` and
120-
`displayNameMaxLength` parameters, respectively. Truncated names are ellipsised in the middle, not just cut off at the end.
118+
It is also possible to set test name length for individual tests by passing the `maxLength` arameter.
119+
Truncated names are ellipsised in the middle, not just cut off at the end.
121120

122121
**→ Check out [the full API docs](https://a-sit-plus.github.io/testballoon-addons/) for each test style for all configuration options!**
123122

commons/src/commonMain/kotlin/at/asitplus/test/TestBalloonCommons.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,6 @@ object TestBalloonAddons {
3232
*/
3333
var defaultTestNameMaxLength: Int = defaultMaxLen
3434

35-
/**
36-
* The default maximum length of display names of test elements created using:
37-
* * `withData`
38-
* * `withDataSuites`
39-
* * `checkAll`
40-
* * `checkAllSuites`
41-
* * FreeSoec
42-
*
43-
* Defaults to `-1` (= no truncation).
44-
*/
45-
var defaultDisplayNameMaxLength: Int = -1
46-
4735
/**
4836
* Hard limit of the maximum path length of a test (i.e. all layers after the root suite's FQN down to the test case).
4937
* The intent of this hard limit is to have tests fail in a controlled manner, in case test names
@@ -58,9 +46,3 @@ object TestBalloonAddons {
5846
}
5947

6048
}
61-
62-
@Deprecated(
63-
"To be removed in 0.8.", replaceWith = ReplaceWith("TestBalloonAddons.defaultTestNameMaxLength"),
64-
DeprecationLevel.WARNING
65-
)
66-
val DEFAULT_TEST_NAME_MAX_LEN: Int get() = TestBalloonAddons.defaultTestNameMaxLength

datatest/src/commonMain/kotlin/at/asitplus/test/Data.kt

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -26,30 +26,18 @@ object DataTest {
2626
var defaultTestNameMaxLength: Int? = null
2727
get() = field ?: TestBalloonAddons.defaultTestNameMaxLength
2828

29-
/**
30-
* The default maximum length of test element display names (not test name).
31-
* Defaults to [TestBalloonAddons.defaultDisplayNameMaxLength], but setting it here will take precedence.
32-
* * `-1` means no truncation.
33-
* * `null` means it will again fall back to [TestBalloonAddons.defaultDisplayNameMaxLength]
34-
*
35-
* This property's getter will never return null, but fall back to [TestBalloonAddons.defaultDisplayNameMaxLength].
36-
*/
37-
var defaultDisplayNameMaxLength: Int? = null
38-
get() = field ?: TestBalloonAddons.defaultDisplayNameMaxLength
39-
4029
}
4130

4231

4332
data class ConfiguredDataTestScope<Data>(
4433
private val compact: Boolean,
4534
private val maxLength: Int,
46-
private val displayNameMaxLength: Int,
4735
val prefix: String,
4836
val testSuite: TestSuiteScope, val map: Sequence<Pair<String, Data>>,
4937
val testConfig: TestConfig = TestConfig,
5038
) {
5139
operator fun minus(action: TestSuiteScope.(Data) -> Unit) =
52-
testSuite.withDataSuitesInternal(map, compact, maxLength, displayNameMaxLength, prefix, testConfig, action)
40+
testSuite.withDataSuitesInternal(map, compact, maxLength, prefix, testConfig, action)
5341
}
5442

5543

@@ -61,7 +49,6 @@ data class ConfiguredDataTestScope<Data>(
6149
* @param testConfig Optional test configuration
6250
* @param compact If true, only a single test element is created and the class name of the data parameter is used as test name
6351
* @param maxLength maximum length of test element name (not display name)
64-
* @param displayNameMaxLength maximum length of test element **display name**
6552
* @param prefix an optional prefix to add to the test name
6653
* @param action Test action to execute for each map value
6754
*/
@@ -70,7 +57,6 @@ internal fun <Data> TestSuiteScope.withDataInternal(
7057
testConfig: TestConfig = TestConfig,
7158
compact: Boolean,
7259
maxLength: Int,
73-
displayNameMaxLength: Int,
7460
prefix: String,
7561
action: suspend Test.ExecutionScope.(Data) -> Unit
7662
) {
@@ -82,7 +68,6 @@ internal fun <Data> TestSuiteScope.withDataInternal(
8268
testSuiteInScope.checkPathLenIncluding(truncatedName)
8369
test(
8470
name = truncatedName,
85-
displayName = (testName.truncated(displayNameMaxLength)),
8671
testConfig = testConfig
8772
) {
8873
val errors = mutableMapOf<String, Throwable?>()
@@ -104,7 +89,6 @@ internal fun <Data> TestSuiteScope.withDataInternal(
10489
testSuiteInScope.checkPathLenIncluding(truncatedName)
10590
test(
10691
name = truncatedName,
107-
displayName = (name.truncated(displayNameMaxLength)),
10892
testConfig = testConfig
10993
) { action(d.second) }
11094
}
@@ -119,15 +103,13 @@ internal fun <Data> TestSuiteScope.withDataInternal(
119103
* @param testConfig Optional test configuration
120104
* @param compact If true, only a single test element is created and the class name of the data parameter is used as test name
121105
* @param maxLength maximum length of test element name (not display name)
122-
* @param displayNameMaxLength maximum length of test element **display name**
123106
* @param prefix an optional prefix to add to the test name
124107
* @param action Test suite configuration action for each data item
125108
*/
126109
internal fun <Data> TestSuiteScope.withDataSuitesInternal(
127110
data: Sequence<Pair<String, Data>>,
128111
compact: Boolean,
129112
maxLength: Int,
130-
displayNameMaxLength: Int,
131113
prefix: String,
132114
testConfig: TestConfig = TestConfig,
133115
action: TestSuiteScope.(Data) -> Unit
@@ -140,7 +122,6 @@ internal fun <Data> TestSuiteScope.withDataSuitesInternal(
140122
testSuiteInScope.checkPathLenIncluding(truncatedName)
141123
testSuite(
142124
name = truncatedName,
143-
displayName = (testName.truncated(displayNameMaxLength)),
144125
testConfig = testConfig
145126
) {
146127
val errors = mutableMapOf<String, Throwable?>()
@@ -162,7 +143,6 @@ internal fun <Data> TestSuiteScope.withDataSuitesInternal(
162143
testSuiteInScope.checkPathLenIncluding(truncatedName)
163144
testSuite(
164145
name = truncatedName,
165-
displayName = (name.truncated(displayNameMaxLength)),
166146
testConfig = testConfig,
167147
content = fun TestSuiteScope.() {
168148
action(d.second)

datatest/src/commonMain/kotlin/at/asitplus/test/Intermediate.iterable.kt

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,18 @@ import de.infix.testBalloon.framework.core.TestSuiteScope
1111
* @param data The iterable collection of test data
1212
* @param compact If true, only a single test element is created and the class name of the data parameter is used as test name
1313
* @param maxLength maximum length of test element name (not display name)
14-
* @param displayNameMaxLength maximum length of test element **display name**
1514
* @param prefix an optional prefix to add to the test name
1615
* @param testConfig Optional test configuration
1716
*/
1817
fun <Data> TestSuiteScope.withData(
1918
data: Iterable<Data>,
2019
compact: Boolean = DataTest.compactByDefault,
2120
maxLength: Int = DataTest.defaultTestNameMaxLength!!,
22-
displayNameMaxLength: Int = DataTest.defaultDisplayNameMaxLength!!,
2321
prefix: String = "",
2422
testConfig: TestConfig = TestConfig,
2523
) = ConfiguredDataTestScope<Data>(
2624
compact,
2725
maxLength,
28-
displayNameMaxLength = displayNameMaxLength,
2926
prefix = prefix,
3027
this,
3128
data.asSequence().map { it.toPrettyString() to it },
@@ -41,7 +38,6 @@ fun <Data> TestSuiteScope.withData(
4138
* @param data The iterable collection of test data
4239
* @param compact If true, only a single test element is created and the class name of the data parameter is used as test name
4340
* @param maxLength maximum length of test element name (not display name)
44-
* @param displayNameMaxLength maximum length of test element **display name**
4541
* @param prefix an optional prefix to add to the test name
4642
* @param testConfig Optional test configuration
4743
*/
@@ -50,13 +46,11 @@ fun <Data> TestSuiteScope.withData(
5046
data: Iterable<Data>,
5147
compact: Boolean = DataTest.compactByDefault,
5248
maxLength: Int = DataTest.defaultTestNameMaxLength!!,
53-
displayNameMaxLength: Int = DataTest.defaultDisplayNameMaxLength!!,
5449
prefix: String = "",
5550
testConfig: TestConfig = TestConfig,
5651
) = ConfiguredDataTestScope<Data>(
5752
compact,
5853
maxLength,
59-
displayNameMaxLength = displayNameMaxLength,
6054
prefix = prefix,
6155
this,
6256
data.asSequence().map { nameFn(it) to it },
@@ -70,24 +64,22 @@ fun <Data> TestSuiteScope.withData(
7064
* @param data The iterable collection of test data
7165
* @param compact If true, only a single test element is created and the class name of the data parameter is used as test name
7266
* @param maxLength maximum length of test element name (not display name)
73-
* @param displayNameMaxLength maximum length of test element **display name**
7467
* @param testConfig Optional test configuration
7568
* @param prefix an optional prefix to add to the test name
7669
* @param action Test suite configuration action for each data item
7770
*/
71+
@Deprecated("will be removed in 0.9.0", ReplaceWith("withData(data, compact, maxLength, prefix, testConfig) - {}"))
7872
fun <Data> TestSuiteScope.withDataSuites(
7973
data: Iterable<Data>,
8074
compact: Boolean = DataTest.compactByDefault,
8175
maxLength: Int = DataTest.defaultTestNameMaxLength!!,
82-
displayNameMaxLength: Int = DataTest.defaultDisplayNameMaxLength!!,
8376
prefix: String = "",
8477
testConfig: TestConfig = TestConfig,
8578
action: TestSuiteScope.(Data) -> Unit
8679
) = withDataSuitesInternal(
8780
data.map { it.toPrettyString() to it }.asSequence(),
8881
compact,
8982
maxLength,
90-
displayNameMaxLength = displayNameMaxLength,
9183
prefix = prefix,
9284
testConfig,
9385
action
@@ -101,25 +93,23 @@ fun <Data> TestSuiteScope.withDataSuites(
10193
* @param data The iterable collection of test data
10294
* @param compact If true, only a single test element is created and the class name of the data parameter is used as test name
10395
* @param maxLength maximum length of test element name (not display name)
104-
* @param displayNameMaxLength maximum length of test element **display name**
10596
* @param prefix an optional prefix to add to the test name
10697
* @param testConfig Optional test configuration
10798
* @param action Test suite configuration action for each data item
10899
*/
100+
@Deprecated("will be removed in 0.9.0", ReplaceWith("withData(nameFn, data, compact, maxLength, prefix, testConfig) - {}"))
109101
fun <Data> TestSuiteScope.withDataSuites(
110102
nameFn: (Data) -> String,
111103
data: Iterable<Data>,
112104
compact: Boolean = DataTest.compactByDefault,
113105
maxLength: Int = DataTest.defaultTestNameMaxLength!!,
114-
displayNameMaxLength: Int = DataTest.defaultDisplayNameMaxLength!!,
115106
prefix: String = "",
116107
testConfig: TestConfig = TestConfig,
117108
action: TestSuiteScope.(Data) -> Unit
118109
) = withDataSuitesInternal(
119110
data.map { nameFn(it) to it }.asSequence(),
120111
compact,
121112
maxLength,
122-
displayNameMaxLength = displayNameMaxLength,
123113
prefix = prefix,
124114
testConfig,
125115
action

datatest/src/commonMain/kotlin/at/asitplus/test/Intermediate.map.kt

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,18 @@ import de.infix.testBalloon.framework.core.TestSuiteScope
1212
* @param map Map of suite names to test data
1313
* @param compact If true, only a single test element is created and the class name of the data parameter is used as test name
1414
* @param maxLength maximum length of test element name (not display name)
15-
* @param displayNameMaxLength maximum length of test element **display name**
1615
* @param prefix an optional prefix to add to the test name
1716
* @param testConfig Optional test configuration
1817
*/
1918
fun <Data> TestSuiteScope.withData(
2019
map: Map<String, Data>,
2120
compact: Boolean = DataTest.compactByDefault,
2221
maxLength: Int = DataTest.defaultTestNameMaxLength!!,
23-
displayNameMaxLength: Int = DataTest.defaultDisplayNameMaxLength!!,
2422
prefix: String = "",
2523
testConfig: TestConfig = TestConfig,
2624
) = ConfiguredDataTestScope<Data>(
2725
compact,
2826
maxLength,
29-
displayNameMaxLength = displayNameMaxLength,
3027
prefix = prefix,
3128
this,
3229
map.asSequence().map { (k, v) -> k to v },
@@ -41,23 +38,21 @@ fun <Data> TestSuiteScope.withData(
4138
* @param testConfig Optional test configuration
4239
* @param compact If true, only a single test element is created and the class name of the data parameter is used as test name
4340
* @param maxLength maximum length of test element name (not display name)
44-
* @param displayNameMaxLength maximum length of test element **display name**
4541
* @param prefix an optional prefix to add to the test name
4642
* @param action Test suite configuration action for each map value
4743
*/
44+
@Deprecated("will be removed in 0.9.0", ReplaceWith("withData(map, compact, maxLength, prefix, testConfig) - {}"))
4845
fun <Data> TestSuiteScope.withDataSuites(
4946
map: Map<String, Data>,
5047
compact: Boolean = DataTest.compactByDefault,
5148
maxLength: Int = DataTest.defaultTestNameMaxLength!!,
52-
displayNameMaxLength: Int = DataTest.defaultDisplayNameMaxLength!!,
5349
prefix: String = "",
5450
testConfig: TestConfig = TestConfig,
5551
action: TestSuiteScope.(Data) -> Unit
5652
) = withDataSuitesInternal(
5753
map.map { (k, v) -> k to v }.asSequence(),
5854
compact,
5955
maxLength,
60-
displayNameMaxLength = displayNameMaxLength,
6156
prefix = prefix,
6257
testConfig,
6358
action

0 commit comments

Comments
 (0)