I checked this out, using my iPhone, and you all were right. When the computer is asleep, it will charge the iPhone, but not when it is shut down.
Another interesting thing I found, though: I could plug my iPod touch into my sleeping Macbook to charge it, as long as the Macbook was plugged into the AC. In order to charge my iPhone while the Mac is sleeping, it has to already be plugged in BEFORE the computer goes to sleep. If it's charging and I close the lid of the laptop, it continues to charge no problem (I checked the stand-by light to make sure the computer was actually asleep), but if I plug it in after the lid is closed, no power. Not sure why that changed from the iPod touch to the iPhone, but I thought it was kind of funny.