Skip to content

Commit 5ac4a05

Browse files
authored
Add build tests for Auth globals (#12227)
1 parent 05f0a1c commit 5ac4a05

File tree

3 files changed

+102
-0
lines changed

3 files changed

+102
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#import <XCTest/XCTest.h>
16+
17+
@import FirebaseAuth;
18+
19+
@interface ObjCAPIGlobalTests : XCTestCase
20+
@end
21+
22+
@implementation ObjCAPIGlobalTests
23+
24+
- (void)GlobalSymbolBuildTest {
25+
__unused NSNotificationName n = FIRAuthStateDidChangeNotification;
26+
NSString *s = FIRAuthErrorDomain;
27+
s = FIRAuthErrorUserInfoNameKey;
28+
s = FIRAuthErrorUserInfoEmailKey;
29+
s = FIRAuthErrorUserInfoUpdatedCredentialKey;
30+
s = FIRAuthErrorUserInfoMultiFactorResolverKey;
31+
s = FIREmailAuthProviderID;
32+
s = FIREmailLinkAuthSignInMethod;
33+
s = FIREmailPasswordAuthSignInMethod;
34+
s = FIRFacebookAuthProviderID;
35+
s = FIRFacebookAuthSignInMethod;
36+
s = FIRGameCenterAuthProviderID;
37+
s = FIRGameCenterAuthSignInMethod;
38+
s = FIRGitHubAuthProviderID;
39+
s = FIRGitHubAuthSignInMethod;
40+
s = FIRGoogleAuthProviderID;
41+
s = FIRGoogleAuthSignInMethod;
42+
#if TARGET_OS_IOS
43+
s = FIRPhoneMultiFactorID;
44+
s = FIRTOTPMultiFactorID;
45+
s = FIRPhoneAuthProviderID;
46+
s = FIRPhoneAuthSignInMethod;
47+
#endif
48+
s = FIRTwitterAuthProviderID;
49+
s = FIRTwitterAuthSignInMethod;
50+
}
51+
@end
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright 2023 Google LLC
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
import Foundation
16+
import XCTest
17+
18+
import FirebaseAuth
19+
20+
/// Tests globals defined in Objective C sources. These globals are for backward compatibility and
21+
/// should not be used in new code.
22+
class SwiftGlobalTests: XCTestCase {
23+
func GlobalSymbolBuildTest() {
24+
let _ = NSNotification.Name.AuthStateDidChange
25+
let _: String = AuthErrorDomain
26+
let _: String = AuthErrorUserInfoNameKey
27+
let _: String = AuthErrorUserInfoEmailKey
28+
let _: String = AuthErrorUserInfoUpdatedCredentialKey
29+
let _: String = AuthErrorUserInfoMultiFactorResolverKey
30+
let _: String = EmailAuthProviderID
31+
let _: String = EmailLinkAuthSignInMethod
32+
let _: String = EmailPasswordAuthSignInMethod
33+
let _: String = FacebookAuthProviderID
34+
let _: String = FacebookAuthSignInMethod
35+
let _: String = GameCenterAuthProviderID
36+
let _: String = GameCenterAuthSignInMethod
37+
let _: String = GitHubAuthProviderID
38+
let _: String = GitHubAuthSignInMethod
39+
let _: String = GoogleAuthProviderID
40+
let _: String = GoogleAuthSignInMethod
41+
#if os(iOS)
42+
let _: String = PhoneMultiFactorID
43+
let _: String = TOTPMultiFactorID
44+
let _: String = PhoneAuthProviderID
45+
let _: String = PhoneAuthSignInMethod
46+
#endif
47+
let _: String = TwitterAuthProviderID
48+
let _: String = TwitterAuthSignInMethod
49+
}
50+
}

Package.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,7 @@ let package = Package(
464464
"FIRAuthTests.m",
465465
"FIRUserTests.m",
466466
"SwiftAPI.swift", // Only builds via CocoaPods testing until Swift source update.
467+
"SwiftGlobalTests.swift", // Only builds via CocoaPods testing until Swift source update.
467468
],
468469
cSettings: [
469470
.headerSearchPath("../../.."),

0 commit comments

Comments
 (0)