Shiva Purana
एतस्मिन्नन्तरे तत्र रक्षार्थं ह्यर्जुनस्य वै ॥ तद्भक्तेश्च परीक्षार्थं शंकरो भक्तवत्सलः॥ २५॥
In the meantime he was there to protect Arjuna And to test his devotion Lord Siva who is affectionate to his devotees.
english translation
etasminnantare tatra rakSArthaM hyarjunasya vai ॥ tadbhaktezca parIkSArthaM zaMkaro bhaktavatsalaH॥ 25॥
hk transliteration by Sanscript