Question: I was installing shelving in my closets, when drilled a hole into studs, the lights flickered momentarily for 2 seconds. 

I stopped drilling, and everything else seems fine now. The circuit didn't break and the lights are no longer flickering.

There doesn't seem to be any sockets around the switch. 

Should I call an electrician or is there anything I should test?

Answer: 
There are three options, some already mentioned.

* You were drawing too much power the power line could provide.   

You can try it by drilling into similar material and watch the lights. If it will flicker you should turn off another device (washer, fridge,...) for a while. If not I have bad news for you...
* You were drilling into powerline.   

Turn off main breaker, insert metal rod in the hole and find what line is connected to it. Open the wall and find the wires near the hole. Or, which is much cleaner way, call electrician. They can detect wires without opening the walls, they use metal detectors for it.
* If all above is false, then you had a bad luck and maybe you and your neighbours were drawing too much at the moment, there was temporal power shortage in your area, who knows. (Thanks Steve Jessop for comment)
Since this is closet, there seems to be no real reason not to go ahead and remove the wallboard (or plaster and lath) a few inches to each side of the stud and see if there is a wire there. You should probably get a [non-contact voltage detector](http://www.myhardwaresupply.com/store/p/20448-Voltage-Detector-Non-contact.aspx?feed=Froogle&gclid=CI_IgqDC1c4CFQ02gQodcOQOxw) and check the vicinity of where you are going to cut just in case there is wiring just behind the wall. Nothing particularly special about this model. There are other similar devices from other makers and you can get them at your local big-box store. Note that just if it doesn't detect anything, that doesn't mean you haven't hit a wire. It might just be too far in the wall.

If there is a wire where you drilled, you should assume you've hit it and repair the wiring. If you decide to fix it yourself, make sure match the wire gauges and put any splices in a junction box that is accessible.

Repairing the wall is fairly easy if you don't have to worry about making it look nice and generally that's not a concern inside a closet. Just cut a piece of drywall a little larger than the hole you created, put it over the hole, trace around it and cut the hole to fit the piece, screw the piece to the stud (short screws!) apply a little mesh tape and smooth on some joint compound.