Skip to content
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

Migrate from test-framework to tasty #1091

Merged
merged 1 commit into from
Mar 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
next [????.??.??]
-----------------
* Replace `test-framework` with `tasty` in the test suite.

5.3.4 [2025.03.03]
------------------
* Reduce the arity of `foldr1Of`, `foldl1Of`, `foldrOf'`, `foldlOf'`,
Expand Down
11 changes: 5 additions & 6 deletions lens.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -367,9 +367,9 @@ test-suite properties
build-depends:
base,
lens,
QuickCheck >= 2.4,
test-framework >= 0.6,
test-framework-quickcheck2 >= 0.2,
QuickCheck >= 2.4,
tasty >= 1.4 && < 1.6,
tasty-quickcheck >= 0.10 && < 0.12,
transformers

test-suite hunit
Expand All @@ -385,13 +385,12 @@ test-suite hunit
build-depends:
base,
containers,
HUnit >= 1.2,
lens,
mtl,
text,
bytestring,
test-framework >= 0.6,
test-framework-hunit >= 0.2
tasty >= 1.4 && < 1.6,
tasty-hunit >= 0.10 && < 0.11

-- We need this dummy test-suite to add simple-reflect to the install plan
--
Expand Down
120 changes: 59 additions & 61 deletions tests/hunit.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ import Data.Map (Map)
#if !(MIN_VERSION_base(4,11,0))
import Data.Monoid
#endif
import Test.Framework.Providers.HUnit
import Test.Framework
import Test.HUnit hiding (test)
import Test.Tasty (defaultMain, testGroup)
import Test.Tasty.HUnit ((@?=), testCase)


data Point =
Expand Down Expand Up @@ -380,62 +379,61 @@ case_correct_indexing_lazy_bytestring =
@?= [Nothing, Just 1, Just 2, Nothing]

main :: IO ()
main = defaultMain
[ testGroup "Main"
[ testCase "read record field" case_read_record_field
, testCase "read state record field" case_read_state_record_field
, testCase "read record field and apply function" case_read_record_field_and_apply_function
, testCase "read state record field and apply function" case_read_state_record_field_and_apply_function
, testCase "write record field" case_write_record_field
, testCase "write state record field" case_write_state_record_field
, testCase "write record field and access new value" case_write_record_field_and_access_new_value
, testCase "write state record field and access new value" case_write_state_record_field_and_access_new_value
, testCase "write record field and access old value" case_write_record_field_and_access_old_value
, testCase "write state record field and access old value" case_write_state_record_field_and_access_old_value
, testCase "modify record field" case_modify_record_field
, testCase "modify state record field" case_modify_state_record_field
, testCase "modify record field and access new value" case_modify_record_field_and_access_new_value
, testCase "modify state record field and access new value" case_modify_state_record_field_and_access_new_value
, testCase "modify record field and access old value" case_modify_record_field_and_access_old_value
, testCase "modify state record field and access old value" case_modify_state_record_field_and_access_old_value
, testCase "modify record field and access side result" case_modify_record_field_and_access_side_result
, testCase "increment record field" case_increment_record_field
, testCase "increment state record field" case_increment_state_record_field
, testCase "append to record field" case_append_to_record_field
, testCase "append to state record field" case_append_to_state_record_field
, testCase "prepend to record field" case_prepend_to_record_field
, testCase "prepend to state record field" case_prepend_to_state_record_field
, testCase "cons to record field" case_cons_to_record_field
, testCase "cons to state record field" case_cons_to_state_record_field
, testCase "snoc to record field" case_snoc_to_record_field
, testCase "snoc to state record field" case_snoc_to_state_record_field
, testCase "append to record field and access new value" case_append_to_record_field_and_access_new_value
, testCase "append to state record field and access new value" case_append_to_state_record_field_and_access_new_value
, testCase "prepend to record field and access new value" case_prepend_to_record_field_and_access_new_value
, testCase "prepend to state record field and access new value" case_prepend_to_state_record_field_and_access_new_value
, testCase "cons to record field and access new value" case_cons_to_record_field_and_access_new_value
, testCase "cons to state record field and access new value" case_cons_to_state_record_field_and_access_new_value
, testCase "snoc to record field and access new value" case_snoc_to_record_field_and_access_new_value
, testCase "snoc to state record field and access new value" case_snoc_to_state_record_field_and_access_new_value
, testCase "append to record field and access old value" case_append_to_record_field_and_access_old_value
, testCase "append to state record field and access old value" case_append_to_state_record_field_and_access_old_value
, testCase "cons to record field and access old value" case_cons_to_record_field_and_access_old_value
, testCase "cons to state record field and access old value" case_cons_to_state_record_field_and_access_old_value
, testCase "snoc to record field and access old value" case_snoc_to_record_field_and_access_old_value
, testCase "snoc to state record field and access old value" case_snoc_to_state_record_field_and_access_old_value
, testCase "read maybe map entry" case_read_maybe_map_entry
, testCase "read maybe state map entry" case_read_maybe_state_map_entry
, testCase "read map entry" case_read_map_entry
, testCase "read state map entry" case_read_state_map_entry
, testCase "modify map entry" case_modify_map_entry
, testCase "insert maybe map entry" case_insert_maybe_map_entry
, testCase "delete maybe map entry" case_delete_maybe_map_entry
, testCase "read list entry" case_read_list_entry
, testCase "write list entry" case_write_list_entry
, testCase "write through list entry" case_write_through_list_entry
, testCase "correct indexing strict text" case_correct_indexing_strict_text
, testCase "correct indexing lazy text" case_correct_indexing_lazy_text
, testCase "correct indexing strict bytestring" case_correct_indexing_strict_bytestring
, testCase "correct indexing lazy bytestring" case_correct_indexing_lazy_bytestring
]
main = defaultMain $
testGroup "Main"
[ testCase "read record field" case_read_record_field
, testCase "read state record field" case_read_state_record_field
, testCase "read record field and apply function" case_read_record_field_and_apply_function
, testCase "read state record field and apply function" case_read_state_record_field_and_apply_function
, testCase "write record field" case_write_record_field
, testCase "write state record field" case_write_state_record_field
, testCase "write record field and access new value" case_write_record_field_and_access_new_value
, testCase "write state record field and access new value" case_write_state_record_field_and_access_new_value
, testCase "write record field and access old value" case_write_record_field_and_access_old_value
, testCase "write state record field and access old value" case_write_state_record_field_and_access_old_value
, testCase "modify record field" case_modify_record_field
, testCase "modify state record field" case_modify_state_record_field
, testCase "modify record field and access new value" case_modify_record_field_and_access_new_value
, testCase "modify state record field and access new value" case_modify_state_record_field_and_access_new_value
, testCase "modify record field and access old value" case_modify_record_field_and_access_old_value
, testCase "modify state record field and access old value" case_modify_state_record_field_and_access_old_value
, testCase "modify record field and access side result" case_modify_record_field_and_access_side_result
, testCase "increment record field" case_increment_record_field
, testCase "increment state record field" case_increment_state_record_field
, testCase "append to record field" case_append_to_record_field
, testCase "append to state record field" case_append_to_state_record_field
, testCase "prepend to record field" case_prepend_to_record_field
, testCase "prepend to state record field" case_prepend_to_state_record_field
, testCase "cons to record field" case_cons_to_record_field
, testCase "cons to state record field" case_cons_to_state_record_field
, testCase "snoc to record field" case_snoc_to_record_field
, testCase "snoc to state record field" case_snoc_to_state_record_field
, testCase "append to record field and access new value" case_append_to_record_field_and_access_new_value
, testCase "append to state record field and access new value" case_append_to_state_record_field_and_access_new_value
, testCase "prepend to record field and access new value" case_prepend_to_record_field_and_access_new_value
, testCase "prepend to state record field and access new value" case_prepend_to_state_record_field_and_access_new_value
, testCase "cons to record field and access new value" case_cons_to_record_field_and_access_new_value
, testCase "cons to state record field and access new value" case_cons_to_state_record_field_and_access_new_value
, testCase "snoc to record field and access new value" case_snoc_to_record_field_and_access_new_value
, testCase "snoc to state record field and access new value" case_snoc_to_state_record_field_and_access_new_value
, testCase "append to record field and access old value" case_append_to_record_field_and_access_old_value
, testCase "append to state record field and access old value" case_append_to_state_record_field_and_access_old_value
, testCase "cons to record field and access old value" case_cons_to_record_field_and_access_old_value
, testCase "cons to state record field and access old value" case_cons_to_state_record_field_and_access_old_value
, testCase "snoc to record field and access old value" case_snoc_to_record_field_and_access_old_value
, testCase "snoc to state record field and access old value" case_snoc_to_state_record_field_and_access_old_value
, testCase "read maybe map entry" case_read_maybe_map_entry
, testCase "read maybe state map entry" case_read_maybe_state_map_entry
, testCase "read map entry" case_read_map_entry
, testCase "read state map entry" case_read_state_map_entry
, testCase "modify map entry" case_modify_map_entry
, testCase "insert maybe map entry" case_insert_maybe_map_entry
, testCase "delete maybe map entry" case_delete_maybe_map_entry
, testCase "read list entry" case_read_list_entry
, testCase "write list entry" case_write_list_entry
, testCase "write through list entry" case_write_through_list_entry
, testCase "correct indexing strict text" case_correct_indexing_strict_text
, testCase "correct indexing lazy text" case_correct_indexing_lazy_text
, testCase "correct indexing strict bytestring" case_correct_indexing_strict_bytestring
, testCase "correct indexing lazy bytestring" case_correct_indexing_lazy_bytestring
]
59 changes: 29 additions & 30 deletions tests/properties.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ module Main where

import Control.Lens
import Test.QuickCheck
import Test.Framework
import Test.Framework.Providers.QuickCheck2
import Test.Tasty (defaultMain, testGroup)
import Test.Tasty.QuickCheck (testProperty)
import Data.Char (isAlphaNum, isAscii, toUpper)
import qualified Data.Text.Strict.Lens as Text
import GHC.Exts (Constraint)
Expand Down Expand Up @@ -129,32 +129,31 @@ equalityIso f = f


main :: IO ()
main = defaultMain
[ testGroup "Main"
[ testProperty "1" prop_1
, testProperty "2" prop_2
, testProperty "3" prop_3
, testProperty "4" prop_4
, testProperty "5" prop_5
, testProperty "6" prop_6
, testProperty "7" prop_7
, testProperty "8" prop_8
, testProperty "9" prop_9
, testProperty "10" prop_10
, testProperty "2 2" prop_2_2
, testProperty "mapped" prop_mapped
, testProperty "mapped mapped" prop_mapped_mapped
, testProperty "both" prop_both
, testProperty "traverseLeft" prop_traverseLeft
, testProperty "traverseRight" prop_traverseRight
, testProperty "simple" prop_simple
, testProperty " Left" prop__Left
, testProperty " Right" prop__Right
, testProperty " Just" prop__Just
, testProperty "prefixed" prop_prefixed
, testProperty "text" prop_text
, testProperty "base show" prop_base_show
, testProperty "base read" prop_base_read
, testProperty "base readFail" prop_base_readFail
]
main = defaultMain $
testGroup "Main"
[ testProperty "1" prop_1
, testProperty "2" prop_2
, testProperty "3" prop_3
, testProperty "4" prop_4
, testProperty "5" prop_5
, testProperty "6" prop_6
, testProperty "7" prop_7
, testProperty "8" prop_8
, testProperty "9" prop_9
, testProperty "10" prop_10
, testProperty "2 2" prop_2_2
, testProperty "mapped" prop_mapped
, testProperty "mapped mapped" prop_mapped_mapped
, testProperty "both" prop_both
, testProperty "traverseLeft" prop_traverseLeft
, testProperty "traverseRight" prop_traverseRight
, testProperty "simple" prop_simple
, testProperty " Left" prop__Left
, testProperty " Right" prop__Right
, testProperty " Just" prop__Just
, testProperty "prefixed" prop_prefixed
, testProperty "text" prop_text
, testProperty "base show" prop_base_show
, testProperty "base read" prop_base_read
, testProperty "base readFail" prop_base_readFail
]