mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-11 22:55:55 +05:45
Fixes #1685. ### Description Swift's `lazy` and `static` property initialization is always thread-safe. However, `key` was only created as an empty dictionary, and the evaluation of `ROT13.string`, which was the one initializing that data, wasn't isolated. By creating `ROT13.key` inline, this ensures that the initialization is only done once in a thread-safe way.
31 lines
788 B
Swift
31 lines
788 B
Swift
//
|
|
// Copyright RevenueCat Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the MIT License (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://opensource.org/licenses/MIT
|
|
//
|
|
// StringExtensionsTests.swift
|
|
//
|
|
// Created by Nacho Soto on 6/10/22.
|
|
|
|
import Foundation
|
|
import Nimble
|
|
import XCTest
|
|
|
|
@testable import RevenueCat
|
|
|
|
class StringExtensionsTests: TestCase {
|
|
|
|
func testROT13() {
|
|
let mangledTrackingClassName = "NGGenpxvatZnantre"
|
|
let mangledAuthStatusPropertyName = "genpxvatNhgubevmngvbaFgnghf"
|
|
|
|
expect(mangledTrackingClassName.rot13()) == "ATTrackingManager"
|
|
expect(mangledAuthStatusPropertyName.rot13()) == "trackingAuthorizationStatus"
|
|
}
|
|
|
|
}
|