mirror of
https://github.com/nix-community/nixpkgs-update.git
synced 2024-10-26 23:33:02 +03:00
Trim newlines GitHub PR titles
The `interpolate` cmd by default is putting a trailing newline on this, as the test case shows, so add an explicit `strip` to it. Fixes #189
This commit is contained in:
parent
9065a0813f
commit
0b0beeca4d
@ -4,7 +4,7 @@ cabal-version: 2.2
|
|||||||
--
|
--
|
||||||
-- see: https://github.com/sol/hpack
|
-- see: https://github.com/sol/hpack
|
||||||
--
|
--
|
||||||
-- hash: 0401b3234ff350b39169d38415559f3fe383a70cd04480c173c8219d5177c8ca
|
-- hash: 07126c7eb0b21ed69827f9646252afa68266648544e4d54c4edf22d074c5bb19
|
||||||
|
|
||||||
name: nixpkgs-update
|
name: nixpkgs-update
|
||||||
version: 0.2.0
|
version: 0.2.0
|
||||||
@ -153,6 +153,7 @@ test-suite spec
|
|||||||
DoctestSpec
|
DoctestSpec
|
||||||
RewriteSpec
|
RewriteSpec
|
||||||
UpdateSpec
|
UpdateSpec
|
||||||
|
UtilsSpec
|
||||||
Paths_nixpkgs_update
|
Paths_nixpkgs_update
|
||||||
hs-source-dirs:
|
hs-source-dirs:
|
||||||
test
|
test
|
||||||
|
@ -127,7 +127,7 @@ prTitle :: UpdateEnv -> Text -> Text
|
|||||||
prTitle updateEnv attrPath =
|
prTitle updateEnv attrPath =
|
||||||
let oV = oldVersion updateEnv
|
let oV = oldVersion updateEnv
|
||||||
nV = newVersion updateEnv
|
nV = newVersion updateEnv
|
||||||
in [interpolate| $attrPath: $oV -> $nV |]
|
in T.strip [interpolate| $attrPath: $oV -> $nV |]
|
||||||
|
|
||||||
regDirMode :: FileMode
|
regDirMode :: FileMode
|
||||||
regDirMode =
|
regDirMode =
|
||||||
|
19
test/UtilsSpec.hs
Normal file
19
test/UtilsSpec.hs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
|
module UtilsSpec where
|
||||||
|
|
||||||
|
import Test.Hspec
|
||||||
|
import qualified Utils
|
||||||
|
|
||||||
|
main :: IO ()
|
||||||
|
main = hspec spec
|
||||||
|
|
||||||
|
spec :: Spec
|
||||||
|
spec = do
|
||||||
|
describe "PR title" do
|
||||||
|
-- This breaks IRC when it tries to link to newly opened pull requests
|
||||||
|
it "should not include a trailing newline" do
|
||||||
|
let options = Utils.Options False False "" False False False False
|
||||||
|
let updateEnv = Utils.UpdateEnv "foobar" "1.0" "1.1" (Just "https://update-site.com") options
|
||||||
|
let title = Utils.prTitle updateEnv "python37Packages.foobar"
|
||||||
|
title `shouldBe` "python37Packages.foobar: 1.0 -> 1.1"
|
Loading…
Reference in New Issue
Block a user