A chloride sweat test is the gold standard test for diagnosing cystic fibrosis, a disease that causes mucus to build up in the lungs and other organs.