@@ -1818,6 +1818,71 @@ class ConvertActionTests: XCTestCase {
1818
1818
] )
1819
1819
}
1820
1820
1821
+ func testBetaInAvailabilityFallbackPlatforms( ) throws {
1822
+
1823
+ func generateConvertAction( currentPlatforms: [ String : PlatformVersion ] ) throws -> ConvertAction {
1824
+ try ConvertAction (
1825
+ documentationBundleURL: bundle. absoluteURL,
1826
+ outOfProcessResolver: nil ,
1827
+ analyze: false ,
1828
+ targetDirectory: targetDirectory,
1829
+ htmlTemplateDirectory: Folder . emptyHTMLTemplateDirectory. absoluteURL,
1830
+ emitDigest: false ,
1831
+ currentPlatforms: currentPlatforms,
1832
+ dataProvider: testDataProvider,
1833
+ fileManager: testDataProvider,
1834
+ temporaryDirectory: testDataProvider. uniqueTemporaryDirectory ( )
1835
+ )
1836
+ }
1837
+ let bundle = Folder ( name: " nested " , content: [
1838
+ Folder ( name: " folders " , content: [
1839
+ Folder ( name: " unit-test.docc " , content: [
1840
+ InfoPlist ( displayName: " TestBundle " , identifier: " com.test.example " ) ,
1841
+ ] ) ,
1842
+ ] )
1843
+ ] )
1844
+ let testDataProvider = try TestFileSystem ( folders: [ bundle, Folder . emptyHTMLTemplateDirectory] )
1845
+ let targetDirectory = URL ( fileURLWithPath: testDataProvider. currentDirectoryPath)
1846
+ . appendingPathComponent ( " target " , isDirectory: true )
1847
+
1848
+ // Test whether the missing platforms copy the availability information from the fallback platform.
1849
+ var action = try generateConvertAction ( currentPlatforms: [ " iOS " : PlatformVersion ( . init( 10 , 0 , 0 ) , beta: true ) ] )
1850
+ XCTAssertEqual ( action. context. externalMetadata. currentPlatforms, [
1851
+ " iOS " : PlatformVersion ( . init( 10 , 0 , 0 ) , beta: true ) ,
1852
+ " Mac Catalyst " : PlatformVersion ( . init( 10 , 0 , 0 ) , beta: true ) ,
1853
+ " iPadOS " : PlatformVersion ( . init( 10 , 0 , 0 ) , beta: true ) ,
1854
+ ] )
1855
+ // Test whether the non-missing platforms don't copy the availability information from the fallback platform.
1856
+ action = try generateConvertAction ( currentPlatforms: [
1857
+ " iOS " : PlatformVersion ( . init( 10 , 0 , 0 ) , beta: true ) ,
1858
+ " Mac Catalyst " : PlatformVersion ( . init( 11 , 0 , 0 ) , beta: false )
1859
+ ] )
1860
+ XCTAssertEqual ( action. context. externalMetadata. currentPlatforms, [
1861
+ " iOS " : PlatformVersion ( . init( 10 , 0 , 0 ) , beta: true ) ,
1862
+ " Mac Catalyst " : PlatformVersion ( . init( 11 , 0 , 0 ) , beta: false ) ,
1863
+ " iPadOS " : PlatformVersion ( . init( 10 , 0 , 0 ) , beta: true )
1864
+ ] )
1865
+ action = try generateConvertAction ( currentPlatforms: [
1866
+ " iOS " : PlatformVersion ( . init( 10 , 0 , 0 ) , beta: true ) ,
1867
+ " Mac Catalyst " : PlatformVersion ( . init( 11 , 0 , 0 ) , beta: true ) ,
1868
+ " iPadOS " : PlatformVersion ( . init( 12 , 0 , 0 ) , beta: false ) ,
1869
+
1870
+ ] )
1871
+ XCTAssertEqual ( action. context. externalMetadata. currentPlatforms, [
1872
+ " iOS " : PlatformVersion ( . init( 10 , 0 , 0 ) , beta: true ) ,
1873
+ " Mac Catalyst " : PlatformVersion ( . init( 11 , 0 , 0 ) , beta: true ) ,
1874
+ " iPadOS " : PlatformVersion ( . init( 12 , 0 , 0 ) , beta: false ) ,
1875
+ ] )
1876
+ // Test whether the non-missing platforms don't copy the availability information from the non-fallback platform.
1877
+ action = try generateConvertAction ( currentPlatforms: [
1878
+ " tvOS " : PlatformVersion ( . init( 13 , 0 , 0 ) , beta: true )
1879
+
1880
+ ] )
1881
+ XCTAssertEqual ( action. context. externalMetadata. currentPlatforms, [
1882
+ " tvOS " : PlatformVersion ( . init( 13 , 0 , 0 ) , beta: true )
1883
+ ] )
1884
+ }
1885
+
1821
1886
func testResolvedTopicReferencesAreCachedByDefaultWhenConverting( ) throws {
1822
1887
let bundle = Folder (
1823
1888
name: " unit-test.docc " ,
0 commit comments