mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-10 22:45:55 +05:45
* refactor: move rules engine into core SDK as internal Move the RulesEngineInternal sources and tests into the RevenueCat target under Sources/RulesEngine and Tests/UnitTests/RulesEngine. The moved symbols are marked internal so no new public API is exposed, and the standalone RulesEngineInternal target is removed from Package manifests, Tuist, the Xcode project, and CI. No usages yet. Co-authored-by: Cursor <cursoragent@cursor.com> * refactor: namespace rules engine types under RulesEngine Nest the generically-named rules engine types (Value, Evaluator, Operators and the per-category operator enums), the JS coercion helpers, and PrintLogger inside the RulesEngine enum so the subsystem exposes a single top-level symbol instead of polluting the RevenueCat module's internal namespace. RulesEngineLogger stays top-level (already prefixed). Production cross-references resolve via enclosing scope; tests use local typealiases or explicit RulesEngine. qualification. Co-authored-by: Cursor <cursoragent@cursor.com> * Document why the rules engine owns its own logging abstraction Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: Cursor <cursoragent@cursor.com>
38 lines
1.0 KiB
Swift
38 lines
1.0 KiB
Swift
//
|
|
// StringArrayOperatorsTests.swift
|
|
//
|
|
// Created by Antonio Pallares.
|
|
//
|
|
|
|
import XCTest
|
|
|
|
@testable import RevenueCat
|
|
|
|
private typealias Value = RulesEngine.Value
|
|
private typealias StringArrayOperators = RulesEngine.StringArrayOperators
|
|
|
|
final class StringArrayOperatorsTests: XCTestCase {
|
|
|
|
// MARK: - merge
|
|
|
|
/// Kept as a Swift test (not migrated to a JSON fixture): `merge`
|
|
/// returns an array, and this engine's loose `==` string-coerces
|
|
/// `[[1], 2]` and `[1, 2]` to the same `"1,2"`, so no predicate can
|
|
/// verify that nested arrays are NOT recursively flattened. Only a
|
|
/// structural `Value` comparison can.
|
|
func testMergeDoesNotRecurseOnNestedArrays() throws {
|
|
// Only one level of flattening — inner arrays remain.
|
|
let out = try StringArrayOperators.opMerge(
|
|
args: arr(arr(arr(.int(1)), .int(2))),
|
|
vars: .null
|
|
)
|
|
XCTAssertEqual(out, arr(arr(.int(1)), .int(2)))
|
|
}
|
|
|
|
// MARK: - Helpers
|
|
|
|
private func arr(_ items: Value...) -> Value {
|
|
.array(items)
|
|
}
|
|
}
|