[Pkg-haskell-commits] [SCM] haskell-testpack branch, master, updated. debian/1.0.2-1-4-gb0d6b36

John Goerzen jgoerzen at complete.org
Fri Apr 23 14:46:58 UTC 2010


The following commit has been merged in the master branch:
commit 96bd3be981b328dc9f6d55ae0ecd50f81e909b8e
Author: John Goerzen <jgoerzen at complete.org>
Date:   Mon Nov 15 12:15:56 2004 +0100

    Generics work
    
    Keywords:
    
    
    (jgoerzen at complete.org--projects/missingh--head--0.5--patch-53)

diff --git a/ChangeLog b/ChangeLog
index a2bc131..764d103 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,19 @@
 # arch-tag: automatic-ChangeLog--jgoerzen at complete.org--projects/missingh--head--0.5
 #
 
+2004-11-15 05:15:56 GMT	John Goerzen <jgoerzen at complete.org>	patch-53
+
+    Summary:
+      Generics work
+    Revision:
+      missingh--head--0.5--patch-53
+
+
+    modified files:
+     ChangeLog libsrc/MissingH/Printf/Types.hs
+     testsrc/Printftest.hs
+
+
 2004-11-15 05:08:21 GMT	John Goerzen <jgoerzen at complete.org>	patch-52
 
     Summary:
diff --git a/libsrc/MissingH/Printf/Types.hs b/libsrc/MissingH/Printf/Types.hs
index 0a488c4..db4748c 100644
--- a/libsrc/MissingH/Printf/Types.hs
+++ b/libsrc/MissingH/Printf/Types.hs
@@ -18,7 +18,7 @@ class PFType a where
     fromValue :: Value -> a
 
 instance Real a => PFType a where
-    toValue = toValue . toRational
+    toValue = ValueRational . toRational
     fromValue = error "fromValue to generic Real not supported"--fromRational . fromValue
 
 instance PFType Integer where
diff --git a/testsrc/Printftest.hs b/testsrc/Printftest.hs
index d0090f3..6b6f3aa 100644
--- a/testsrc/Printftest.hs
+++ b/testsrc/Printftest.hs
@@ -33,6 +33,16 @@ test_vsprintf =
     "FE" @=? vsprintf "%X" (254::Integer)
     "10" @=? vsprintf "%o" (8::Integer)
 
+test_vsprintf_generics =
+    do
+    "foo: 5" @=? vsprintf "%s: %d" "foo" (5::Int)
+    "%foo%:% %-1%\n%" @=? vsprintf "%%%s%%:%% %%%d%%\n%%" "foo" (-1::Integer)
+    "baz: 3.140000" @=? vsprintf "%s: %f" "baz" (3.14::Rational)
+    "quux: 3.140000e+02" @=? vsprintf "%s: %e" "quux" (314::Double)
+    "fe" @=? vsprintf "%x" (254::Int)
+    "FE" @=? vsprintf "%X" (254::Int)
+    "10" @=? vsprintf "%o" (8::Int)
+
 test_vsprintf_strings =
     do
     ".     ." @=? vsprintf ".%5s." ""
@@ -50,5 +60,6 @@ test_vsprintf_strings =
   -- TODO: test numeric types  
     
 tests = TestList [TestLabel "vsprintf" (TestCase test_vsprintf),
+                  TestLabel "vsprintf generics" (TestCase test_vsprintf_generics),
                   TestLabel "vsprintf strings" (TestCase test_vsprintf_strings)
                  ]
\ No newline at end of file

-- 
haskell-testpack



More information about the Pkg-haskell-commits mailing list