Skip to content

Commit 4483d33

Browse files
authored
Update to work with pony 0.74.0 (#132)
Pony 0.74.0 merged the pony_check package into pony_test. Property1 becomes Property, and property tests register through test.property() instead of Property1UnitTest wrappers.
1 parent 1ee3a4a commit 4483d33

9 files changed

Lines changed: 59 additions & 72 deletions
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
## Update to work with pony 0.74.0
2+
3+
Pony 0.74.0 merged the `pony_check` package into `pony_test`. This release updates hobby to use the merged API. The minimum required ponyc version is now 0.74.0.

‎README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ hobby is beta quality software that will change frequently. Expect breaking chan
88

99
## Installation
1010

11-
* Requires ponyc 0.73.0 or later.
11+
* Requires ponyc 0.74.0 or later.
1212
* Install [corral](https://github.com/ponylang/corral)
1313
* `corral add github.com/ponylang/hobby.git --version 0.17.0`
1414
* `corral fetch` to fetch your dependencies

‎corral.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"deps": [
1414
{
1515
"locator": "github.com/ponylang/stallion.git",
16-
"version": "0.14.0"
16+
"version": "0.15.0"
1717
}
1818
]
1919
}

‎hobby/_test_content_type.pony‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
use "pony_test"
2-
use "pony_check"
32

43
primitive \nodoc\ _TestContentTypeList
54
fun tests(test: PonyTest) =>
6-
test(Property1UnitTest[String](_PropertyKnownExtensionMapsToMIME))
7-
test(Property1UnitTest[String](_PropertyUnknownExtensionMapsToOctetStream))
5+
test.property(_PropertyKnownExtensionMapsToMIME)
6+
test.property(_PropertyUnknownExtensionMapsToOctetStream)
87
test(_TestContentTypeCaseInsensitive)
9-
test(Property1UnitTest[(String, String)](_PropertyOverrideReplacesDefault))
10-
test(Property1UnitTest[(String, String)](_PropertyOverrideAddsNew))
8+
test.property(_PropertyOverrideReplacesDefault)
9+
test.property(_PropertyOverrideAddsNew)
1110
test(_TestOverridePreservesDefaults)
1211
test(_TestOverrideCaseInsensitive)
1312

@@ -41,7 +40,7 @@ primitive \nodoc\ _GenMIMEType
4140
.map[String]({(s: String): String => "test/" + s })
4241

4342
// --- Property tests ---
44-
class \nodoc\ iso _PropertyKnownExtensionMapsToMIME is Property1[String]
43+
class \nodoc\ iso _PropertyKnownExtensionMapsToMIME is Property[String]
4544
"""
4645
Every known extension maps to a non-empty, non-default MIME type.
4746
"""
@@ -56,7 +55,7 @@ class \nodoc\ iso _PropertyKnownExtensionMapsToMIME is Property1[String]
5655
h.assert_ne[String]("application/octet-stream", mime)
5756

5857
class \nodoc\ iso _PropertyUnknownExtensionMapsToOctetStream is
59-
Property1[String]
58+
Property[String]
6059
"""
6160
Unknown extensions map to application/octet-stream.
6261
"""
@@ -70,7 +69,7 @@ class \nodoc\ iso _PropertyUnknownExtensionMapsToOctetStream is
7069
h.assert_eq[String]("application/octet-stream", ct(ext))
7170

7271
class \nodoc\ iso _PropertyOverrideReplacesDefault is
73-
Property1[(String, String)]
72+
Property[(String, String)]
7473
"""
7574
Overriding a known extension replaces the default MIME type.
7675
"""
@@ -86,7 +85,7 @@ class \nodoc\ iso _PropertyOverrideReplacesDefault is
8685
h.assert_eq[String](mime, ct(ext))
8786

8887
class \nodoc\ iso _PropertyOverrideAddsNew is
89-
Property1[(String, String)]
88+
Property[(String, String)]
9089
"""
9190
Adding an unknown extension via add makes it resolvable.
9291
"""

‎hobby/_test_etag.pony‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
use "pony_test"
2-
use "pony_check"
32

43
primitive \nodoc\ _TestETagList
54
fun tests(test: PonyTest) =>
@@ -12,8 +11,8 @@ primitive \nodoc\ _TestETagList
1211
test(_TestETagCommaSeparatedNoMatch)
1312
test(_TestETagStrongMatchesWeak)
1413
test(_TestETagCaseInsensitivePrefix)
15-
test(Property1UnitTest[(U64, USize, I64)](_PropertyETagSelfMatch))
16-
test(Property1UnitTest[(U64, USize, I64)](_PropertyETagWildcardMatch))
14+
test.property(_PropertyETagSelfMatch)
15+
test.property(_PropertyETagWildcardMatch)
1716

1817
// --- Example-based tests ---
1918
class \nodoc\ iso _TestETagFormat is UnitTest
@@ -105,7 +104,7 @@ class \nodoc\ iso _TestETagCaseInsensitivePrefix is UnitTest
105104
h.assert_true(_ETag.matches("w/\"1-20-12345\"", etag))
106105

107106
// --- Property tests ---
108-
class \nodoc\ iso _PropertyETagSelfMatch is Property1[(U64, USize, I64)]
107+
class \nodoc\ iso _PropertyETagSelfMatch is Property[(U64, USize, I64)]
109108
"""
110109
An ETag always matches itself (all three components varied).
111110
"""
@@ -120,7 +119,7 @@ class \nodoc\ iso _PropertyETagSelfMatch is Property1[(U64, USize, I64)]
120119
let etag = _ETag(inode, size, mtime)
121120
h.assert_true(_ETag.matches(etag, etag))
122121

123-
class \nodoc\ iso _PropertyETagWildcardMatch is Property1[(U64, USize, I64)]
122+
class \nodoc\ iso _PropertyETagWildcardMatch is Property[(U64, USize, I64)]
124123
"""
125124
`*` matches any generated ETag (all three components varied).
126125
"""

‎hobby/_test_http_date.pony‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
use "pony_test"
2-
use "pony_check"
32

43
primitive \nodoc\ _TestHTTPDateList
54
fun tests(test: PonyTest) =>
65
test(_TestHTTPDateEpochZero)
76
test(_TestHTTPDateSunday)
87
test(_TestHTTPDateKnownDate)
9-
test(Property1UnitTest[I64](_PropertyHTTPDateLength))
10-
test(Property1UnitTest[I64](_PropertyHTTPDateEndsWithGMT))
11-
test(Property1UnitTest[I64](_PropertyHTTPDateStartsWithDayName))
12-
test(Property1UnitTest[I64](_PropertyHTTPDateDayPadded))
8+
test.property(_PropertyHTTPDateLength)
9+
test.property(_PropertyHTTPDateEndsWithGMT)
10+
test.property(_PropertyHTTPDateStartsWithDayName)
11+
test.property(_PropertyHTTPDateDayPadded)
1312

1413
// --- Generators ---
1514
primitive \nodoc\ _GenEpochSeconds
@@ -53,7 +52,7 @@ class \nodoc\ iso _TestHTTPDateKnownDate is UnitTest
5352
"Mon, 15 Jul 2024 14:30:00 GMT", _HTTPDate(1_721_053_800))
5453

5554
// --- Property tests ---
56-
class \nodoc\ iso _PropertyHTTPDateLength is Property1[I64]
55+
class \nodoc\ iso _PropertyHTTPDateLength is Property[I64]
5756
"""
5857
IMF-fixdate is always 29 characters.
5958
"""
@@ -64,7 +63,7 @@ class \nodoc\ iso _PropertyHTTPDateLength is Property1[I64]
6463
fun property(seconds: I64, h: PropertyHelper) =>
6564
h.assert_eq[USize](29, _HTTPDate(seconds).size())
6665

67-
class \nodoc\ iso _PropertyHTTPDateEndsWithGMT is Property1[I64]
66+
class \nodoc\ iso _PropertyHTTPDateEndsWithGMT is Property[I64]
6867
"""
6968
Output always ends with ' GMT'.
7069
"""
@@ -78,7 +77,7 @@ class \nodoc\ iso _PropertyHTTPDateEndsWithGMT is Property1[I64]
7877
result.contains(" GMT"),
7978
"Expected ' GMT' suffix in: " + result)
8079

81-
class \nodoc\ iso _PropertyHTTPDateStartsWithDayName is Property1[I64]
80+
class \nodoc\ iso _PropertyHTTPDateStartsWithDayName is Property[I64]
8281
"""
8382
Output always starts with a valid 3-letter day name followed by ', '.
8483
"""
@@ -103,7 +102,7 @@ class \nodoc\ iso _PropertyHTTPDateStartsWithDayName is Property1[I64]
103102
found,
104103
"Expected valid day prefix in: " + result)
105104

106-
class \nodoc\ iso _PropertyHTTPDateDayPadded is Property1[I64]
105+
class \nodoc\ iso _PropertyHTTPDateDayPadded is Property[I64]
107106
"""
108107
Day-of-month is always 2 digits (zero-padded).
109108
"""

‎hobby/_test_route_group.pony‎

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
use "pony_test"
2-
use "pony_check"
32
use "collections"
43
use stallion = "stallion"
54

65
primitive \nodoc\ _TestRouteGroupList
76
fun tests(test: PonyTest) =>
87
// Property tests
9-
test(Property1UnitTest[
10-
(String, String)](_PropertyGroupPrefixMatches))
11-
test(Property1UnitTest[
12-
(String, String, String)](
13-
_PropertyNestedGroupPrefixOrder))
14-
test(Property1UnitTest[
15-
(String, String)](
16-
_PropertyGroupFlattenEquivalence))
8+
test.property(_PropertyGroupPrefixMatches)
9+
test.property(_PropertyNestedGroupPrefixOrder)
10+
test.property(_PropertyGroupFlattenEquivalence)
1711
// Example tests
1812
test(_TestJoinPath)
1913
test(_TestEmptyGroup)
@@ -32,7 +26,7 @@ primitive \nodoc\ _GenSegment
3226

3327
// --- Property tests ---
3428
class \nodoc\ iso _PropertyGroupPrefixMatches is
35-
Property1[(String, String)]
29+
Property[(String, String)]
3630
"""
3731
A route registered via a group matches at the joined path.
3832
"""
@@ -58,7 +52,7 @@ class \nodoc\ iso _PropertyGroupPrefixMatches is
5852
end
5953

6054
class \nodoc\ iso _PropertyNestedGroupPrefixOrder is
61-
Property1[(String, String, String)]
55+
Property[(String, String, String)]
6256
"""
6357
Nested group paths join as outer + inner + route.
6458
"""
@@ -87,7 +81,7 @@ class \nodoc\ iso _PropertyNestedGroupPrefixOrder is
8781
end
8882

8983
class \nodoc\ iso _PropertyGroupFlattenEquivalence is
90-
Property1[(String, String)]
84+
Property[(String, String)]
9185
"""
9286
Flattened group route matches the same as a manually built route.
9387
"""

‎hobby/_test_router.pony‎

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,21 @@
11
use "pony_test"
2-
use "pony_check"
32
use "collections"
43
use stallion = "stallion"
54

65
primitive \nodoc\ _TestRouterList
76
fun tests(test: PonyTest) =>
8-
test(Property1UnitTest[String](_PropertyStaticRouteMatches))
9-
test(Property1UnitTest[String](_PropertyUnregisteredReturnsMiss))
10-
test(Property1UnitTest[
11-
(String, String)](_PropertyParamExtraction))
12-
test(Property1UnitTest[
13-
(String, String, String)](_PropertyMultipleParams))
14-
test(Property1UnitTest[stallion.Method](_PropertyMethodIsolation))
15-
test(Property1UnitTest[String](_PropertyWildcardCapture))
7+
test.property(_PropertyStaticRouteMatches)
8+
test.property(_PropertyUnregisteredReturnsMiss)
9+
test.property(_PropertyParamExtraction)
10+
test.property(_PropertyMultipleParams)
11+
test.property(_PropertyMethodIsolation)
12+
test.property(_PropertyWildcardCapture)
1613
test(_TestStaticPriorityOverParam)
1714
test(_TestRootPath)
1815
test(_TestOverlappingPrefixes)
1916
test(_TestWildcardSingleSegment)
2017
test(_TestTrailingSlashNormalization)
21-
test(Property1UnitTest[
22-
(Array[USize] val, Array[USize] val)](
23-
_PropertyInsertionOrderInvariance))
18+
test.property(_PropertyInsertionOrderInvariance)
2419
test(_TestHeadFallbackInRouter)
2520
test(_TestInterceptorAccumulation)
2621
test(_TestMissCarriesInterceptors)
@@ -51,7 +46,7 @@ primitive \nodoc\ _TestRouterList
5146
test(_TestDoubleSlashNormalization)
5247
test(_TestWildcardDoubleSlashNormalization)
5348
test(_TestSplitSegmentsEdgeCases)
54-
test(Property1UnitTest[String](_PropertySplitJoinRoundTrip))
49+
test.property(_PropertySplitJoinRoundTrip)
5550
test(_TestJoinRemainingSegments)
5651
test(_TestRoutesBeforeInterceptors)
5752
test(_TestMethodNotAllowedCarriesInterceptors)
@@ -113,7 +108,7 @@ primitive \nodoc\ _NoOpFactory
113108
RequestHandler(consume ctx).respond(stallion.StatusOK, "ok")
114109

115110
// --- Property tests ---
116-
class \nodoc\ iso _PropertyStaticRouteMatches is Property1[String]
111+
class \nodoc\ iso _PropertyStaticRouteMatches is Property[String]
117112
"""
118113
A registered static route always matches.
119114
"""
@@ -132,7 +127,7 @@ class \nodoc\ iso _PropertyStaticRouteMatches is Property1[String]
132127
h.fail("expected match for " + path)
133128
end
134129

135-
class \nodoc\ iso _PropertyUnregisteredReturnsMiss is Property1[String]
130+
class \nodoc\ iso _PropertyUnregisteredReturnsMiss is Property[String]
136131
"""
137132
An unregistered path returns _RouteMiss.
138133
"""
@@ -151,7 +146,7 @@ class \nodoc\ iso _PropertyUnregisteredReturnsMiss is Property1[String]
151146
end
152147

153148
class \nodoc\ iso _PropertyParamExtraction is
154-
Property1[(String, String)]
149+
Property[(String, String)]
155150
"""
156151
`:name` segments are captured correctly.
157152
"""
@@ -182,7 +177,7 @@ class \nodoc\ iso _PropertyParamExtraction is
182177
end
183178

184179
class \nodoc\ iso _PropertyMultipleParams is
185-
Property1[(String, String, String)]
180+
Property[(String, String, String)]
186181
"""
187182
Multiple `:name` segments are all extracted.
188183
"""
@@ -221,7 +216,7 @@ class \nodoc\ iso _PropertyMultipleParams is
221216
end
222217

223218
class \nodoc\ iso _PropertyMethodIsolation is
224-
Property1[stallion.Method]
219+
Property[stallion.Method]
225220
"""
226221
A route registered for one method does not match another.
227222
"""
@@ -259,7 +254,7 @@ class \nodoc\ iso _PropertyMethodIsolation is
259254
h.fail("should be 405, not 404")
260255
end
261256

262-
class \nodoc\ iso _PropertyWildcardCapture is Property1[String]
257+
class \nodoc\ iso _PropertyWildcardCapture is Property[String]
263258
"""
264259
`*name` captures the remainder of the path.
265260
"""
@@ -830,7 +825,7 @@ class \nodoc\ iso _Test405MergeDeduplicatesOverlappingMethods
830825

831826
// --- Property test: insertion order invariance ---
832827
class \nodoc\ iso _PropertyInsertionOrderInvariance is
833-
Property1[(Array[USize] val, Array[USize] val)]
828+
Property[(Array[USize] val, Array[USize] val)]
834829
"""
835830
Route lookup results are independent of insertion order.
836831
@@ -1862,7 +1857,7 @@ class \nodoc\ iso _TestSplitSegmentsEdgeCases is UnitTest
18621857
h.fail("param/wildcard segment access failed")
18631858
end
18641859

1865-
class \nodoc\ iso _PropertySplitJoinRoundTrip is Property1[String]
1860+
class \nodoc\ iso _PropertySplitJoinRoundTrip is Property[String]
18661861
"""
18671862
Splitting a static path into segments and joining them all back produces
18681863
the original path without the leading slash.

0 commit comments

Comments
 (0)