home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.lang.c++.moderated      Moderated discussion of C++ superhackery      33,346 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 32,766 of 33,346   
   Dave Abrahams to All   
   Re: Unit Testing Frameworks (was Re: Sin   
   27 Dec 12 14:11:17   
   
   From: dave@boostpro.com   
      
   on Thu Dec 27 2012, Ian Collins  wrote:   
      
   >> Unless certainly the test is not interested in the singleton   
   >> object's state, then it is even simpler:   
   >>   
   >> NullLogger l;   
   >> Logger& GetLogger() { return l;}   
   >>   
   >> and the cases skip the fist line.   
   >>   
   >> I repeat my original question: what the heck can possibly be that   
   >> test-ruining boogie related to singleton usage?   
   >   
   > I'd like to know the answer to that as well.   
      
   A logger singleton is probably not the greatest example for proving this   
   point, because its actions are usually benign and often untested.   
   However, the use of a singleton may impede or prevent the logger from   
   being replaced for testing purposes, or prevent different loggers from   
   being used for individual tests.   
      
   --   
   Dave Abrahams   
   BoostPro Computing                  Software Development        Training   
   http://www.boostpro.com             Clang/LLVM/EDG Compilers  C++  Boost   
      
      
         [ See http://www.gotw.ca/resources/clcm.htm for info about ]   
         [ comp.lang.c++.moderated.    First time posters: Do this! ]   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca