safe-coloured-text-layout-gen 0.0.0.0 → 0.0.0.1
raw patch · 9 files changed
+137/−3 lines, 9 filesdep +textPVP ok
version bump matches the API change (PVP)
Dependencies added: text
API changes (from Hackage documentation)
Files
- CHANGELOG.md +7/−0
- safe-coloured-text-layout-gen.cabal +12/−3
- test/Text/Colour/LayoutSpec.hs +87/−0
- test_resources/background.dat +5/−0
- test_resources/bicolour-background.dat +5/−0
- test_resources/custom-column-separator.dat +10/−0
- test_resources/list.dat +4/−0
- test_resources/table-with-rows-of-unequal-length.dat +3/−0
- test_resources/two-columns.dat +4/−0
+ CHANGELOG.md view
@@ -0,0 +1,7 @@+# Changelog for safe-coloured-text-layout-gen++## [0.0.0.1] - 2024-08-03++### Changed++* Moved the test suite here from `safe-coloured-text-layout`
safe-coloured-text-layout-gen.cabal view
@@ -1,11 +1,11 @@ cabal-version: 1.12 --- This file has been generated from package.yaml by hpack version 0.34.4.+-- This file has been generated from package.yaml by hpack version 0.36.0. -- -- see: https://github.com/sol/hpack name: safe-coloured-text-layout-gen-version: 0.0.0.0+version: 0.0.0.1 description: Generators for types in safe-coloured-text-layout homepage: https://github.com/NorfairKing/safe-coloured-text#readme bug-reports: https://github.com/NorfairKing/safe-coloured-text/issues@@ -14,6 +14,14 @@ copyright: Copyright (c) 2021 Tom Sydney Kerckhove license: MIT build-type: Simple+extra-source-files:+ CHANGELOG.md+ test_resources/background.dat+ test_resources/bicolour-background.dat+ test_resources/custom-column-separator.dat+ test_resources/list.dat+ test_resources/table-with-rows-of-unequal-length.dat+ test_resources/two-columns.dat source-repository head type: git@@ -38,6 +46,7 @@ main-is: Spec.hs other-modules: Text.Colour.Layout.GenSpec+ Text.Colour.LayoutSpec Paths_safe_coloured_text_layout_gen hs-source-dirs: test@@ -48,8 +57,8 @@ base >=4.7 && <5 , genvalidity-sydtest , safe-coloured-text- , safe-coloured-text-gen , safe-coloured-text-layout , safe-coloured-text-layout-gen , sydtest+ , text default-language: Haskell2010
+ test/Text/Colour/LayoutSpec.hs view
@@ -0,0 +1,87 @@+{-# LANGUAGE OverloadedStrings #-}++module Text.Colour.LayoutSpec (spec) where++import qualified Data.Text as T+import Test.Syd+import Text.Colour+import Text.Colour.Layout++spec :: Spec+spec = do+ let gf = ("test_resources/" ++)+ describe "layoutAsTable" $ do+ it "outputs this list the same as before" $ do+ pureGoldenTextFile+ (gf "list.dat")+ ( renderChunksText+ With24BitColours+ ( layoutAsTable+ [ [["this"]],+ [["is"]],+ [["a"]],+ [["list"]]+ ]+ )+ )+ it "outputs this two-column table the same as before" $ do+ pureGoldenTextFile+ (gf "two-columns.dat")+ ( renderChunksText+ With24BitColours+ ( layoutAsTable+ [ [["this"], ["this"]],+ [["is"], ["is"]],+ [["a"], ["another"]],+ [["list"], ["list"]]+ ]+ )+ )+ it "outputs this weird two-column table the same as before" $ do+ pureGoldenTextFile+ (gf "table-with-rows-of-unequal-length.dat")+ ( renderChunksText+ With24BitColours+ ( layoutAsTable+ [ [["what"], ["the"], []],+ [["is"], ["this"], [], ["-ing"], []],+ [["I"], ["don't"], ["understand"], ["one"], [], ["of"], ["it"]]+ ]+ )+ )+ it "outputs this two-column table with a custom column separator the same as before" $ do+ pureGoldenTextFile+ (gf "custom-column-separator.dat")+ ( renderChunksText+ With24BitColours+ ( renderTable $+ ( table $ [[[chunk (T.pack (show (x + y)))] | x <- [0 :: Int .. 9]] | y <- [0 :: Int .. 9]]+ )+ { tableColumnSeparator = "@"+ }+ )+ )+ it "outputs this table with a background colour the same as before" $ do+ pureGoldenTextFile+ (gf "background.dat")+ ( renderChunksText+ With24BitColours+ ( renderTable $+ ( table $ [[[fore red $ chunk (T.pack (show (x ^ y)))] | x <- [0 :: Int .. 4]] | y <- [0 :: Int .. 4]]+ )+ { tableBackground = Just (SingleColour black)+ }+ )+ )+ it "outputs this table with a bicoloured background the same as before" $ do+ pureGoldenTextFile+ (gf "bicolour-background.dat")+ ( renderChunksText+ With24BitColours+ ( renderTable $+ ( table $ [[[fore red $ chunk (T.pack (show (x ^ y)))] | x <- [0 :: Int .. 4]] | y <- [0 :: Int .. 4]]+ )+ { tableBackground = Just (Bicolour (Just black) (Just brightBlack))+ }+ )+ )
+ test_resources/background.dat view
@@ -0,0 +1,5 @@+[31;40m1[m[40m[m[40m [m[31;40m1[m[40m[m[40m [m[31;40m1[m[40m [m[40m [m[31;40m1[m[40m [m[40m [m[31;40m1[m[40m [m+[31;40m0[m[40m[m[40m [m[31;40m1[m[40m[m[40m [m[31;40m2[m[40m [m[40m [m[31;40m3[m[40m [m[40m [m[31;40m4[m[40m [m+[31;40m0[m[40m[m[40m [m[31;40m1[m[40m[m[40m [m[31;40m4[m[40m [m[40m [m[31;40m9[m[40m [m[40m [m[31;40m16[m[40m [m+[31;40m0[m[40m[m[40m [m[31;40m1[m[40m[m[40m [m[31;40m8[m[40m [m[40m [m[31;40m27[m[40m[m[40m [m[31;40m64[m[40m [m+[31;40m0[m[40m[m[40m [m[31;40m1[m[40m[m[40m [m[31;40m16[m[40m[m[40m [m[31;40m81[m[40m[m[40m [m[31;40m256[m[40m[m
+ test_resources/bicolour-background.dat view
@@ -0,0 +1,5 @@+[31;40m1[m[40m[m[40m [m[31;40m1[m[40m[m[40m [m[31;40m1[m[40m [m[40m [m[31;40m1[m[40m [m[40m [m[31;40m1[m[40m [m+[31;100m0[m[100m[m[100m [m[31;100m1[m[100m[m[100m [m[31;100m2[m[100m [m[100m [m[31;100m3[m[100m [m[100m [m[31;100m4[m[100m [m+[31;40m0[m[40m[m[40m [m[31;40m1[m[40m[m[40m [m[31;40m4[m[40m [m[40m [m[31;40m9[m[40m [m[40m [m[31;40m16[m[40m [m+[31;100m0[m[100m[m[100m [m[31;100m1[m[100m[m[100m [m[31;100m8[m[100m [m[100m [m[31;100m27[m[100m[m[100m [m[31;100m64[m[100m [m+[31;40m0[m[40m[m[40m [m[31;40m1[m[40m[m[40m [m[31;40m16[m[40m[m[40m [m[31;40m81[m[40m[m[40m [m[31;40m256[m[40m[m
+ test_resources/custom-column-separator.dat view
@@ -0,0 +1,10 @@+0@1 @2 @3 @4 @5 @6 @7 @8 @9 +1@2 @3 @4 @5 @6 @7 @8 @9 @10+2@3 @4 @5 @6 @7 @8 @9 @10@11+3@4 @5 @6 @7 @8 @9 @10@11@12+4@5 @6 @7 @8 @9 @10@11@12@13+5@6 @7 @8 @9 @10@11@12@13@14+6@7 @8 @9 @10@11@12@13@14@15+7@8 @9 @10@11@12@13@14@15@16+8@9 @10@11@12@13@14@15@16@17+9@10@11@12@13@14@15@16@17@18
+ test_resources/list.dat view
@@ -0,0 +1,4 @@+this+is +a +list
+ test_resources/table-with-rows-of-unequal-length.dat view
@@ -0,0 +1,3 @@+what the +is this -ing +I don't understand one of it
+ test_resources/two-columns.dat view
@@ -0,0 +1,4 @@+this this +is is +a another+list list