Skip to content

Commit

Permalink
Add build tests for Auth globals (#12227)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Jan 2, 2024
1 parent 05f0a1c commit 5ac4a05
Show file tree
Hide file tree
Showing 3 changed files with 102 additions and 0 deletions.
51 changes: 51 additions & 0 deletions FirebaseAuth/Tests/Unit/ObjCGlobalTests.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <XCTest/XCTest.h>

@import FirebaseAuth;

@interface ObjCAPIGlobalTests : XCTestCase
@end

@implementation ObjCAPIGlobalTests

- (void)GlobalSymbolBuildTest {
__unused NSNotificationName n = FIRAuthStateDidChangeNotification;
NSString *s = FIRAuthErrorDomain;
s = FIRAuthErrorUserInfoNameKey;
s = FIRAuthErrorUserInfoEmailKey;
s = FIRAuthErrorUserInfoUpdatedCredentialKey;
s = FIRAuthErrorUserInfoMultiFactorResolverKey;
s = FIREmailAuthProviderID;
s = FIREmailLinkAuthSignInMethod;
s = FIREmailPasswordAuthSignInMethod;
s = FIRFacebookAuthProviderID;
s = FIRFacebookAuthSignInMethod;
s = FIRGameCenterAuthProviderID;
s = FIRGameCenterAuthSignInMethod;
s = FIRGitHubAuthProviderID;
s = FIRGitHubAuthSignInMethod;
s = FIRGoogleAuthProviderID;
s = FIRGoogleAuthSignInMethod;
#if TARGET_OS_IOS
s = FIRPhoneMultiFactorID;
s = FIRTOTPMultiFactorID;
s = FIRPhoneAuthProviderID;
s = FIRPhoneAuthSignInMethod;
#endif
s = FIRTwitterAuthProviderID;
s = FIRTwitterAuthSignInMethod;
}
@end
50 changes: 50 additions & 0 deletions FirebaseAuth/Tests/Unit/SwiftGlobalTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Copyright 2023 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

import Foundation
import XCTest

import FirebaseAuth

/// Tests globals defined in Objective C sources. These globals are for backward compatibility and
/// should not be used in new code.
class SwiftGlobalTests: XCTestCase {
func GlobalSymbolBuildTest() {
let _ = NSNotification.Name.AuthStateDidChange
let _: String = AuthErrorDomain
let _: String = AuthErrorUserInfoNameKey
let _: String = AuthErrorUserInfoEmailKey
let _: String = AuthErrorUserInfoUpdatedCredentialKey
let _: String = AuthErrorUserInfoMultiFactorResolverKey
let _: String = EmailAuthProviderID
let _: String = EmailLinkAuthSignInMethod
let _: String = EmailPasswordAuthSignInMethod
let _: String = FacebookAuthProviderID
let _: String = FacebookAuthSignInMethod
let _: String = GameCenterAuthProviderID
let _: String = GameCenterAuthSignInMethod
let _: String = GitHubAuthProviderID
let _: String = GitHubAuthSignInMethod
let _: String = GoogleAuthProviderID
let _: String = GoogleAuthSignInMethod
#if os(iOS)
let _: String = PhoneMultiFactorID
let _: String = TOTPMultiFactorID
let _: String = PhoneAuthProviderID
let _: String = PhoneAuthSignInMethod
#endif
let _: String = TwitterAuthProviderID
let _: String = TwitterAuthSignInMethod
}
}
1 change: 1 addition & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ let package = Package(
"FIRAuthTests.m",
"FIRUserTests.m",
"SwiftAPI.swift", // Only builds via CocoaPods testing until Swift source update.
"SwiftGlobalTests.swift", // Only builds via CocoaPods testing until Swift source update.
],
cSettings: [
.headerSearchPath("../../.."),
Expand Down

0 comments on commit 5ac4a05

Please sign in to comment.