[ObjCExport] Implement test - kdocWithBlockTags

FL-23390
This commit is contained in:
Sebastian Sellmair
2023-12-07 11:03:19 +01:00
committed by Space Team
parent e409c60780
commit 885a7dcd8f
3 changed files with 135 additions and 0 deletions
@@ -110,6 +110,11 @@ class ObjCExportHeaderGeneratorTest(val generator: HeaderGenerator) {
doTest(headersTestDataDir.resolve("functionWithErrorType"))
}
@Test
fun `test - kdocWithBlockTags`() {
doTest(headersTestDataDir.resolve("kdocWithBlockTags"))
}
fun interface HeaderGenerator {
fun generateHeaders(root: File): String
}
@@ -0,0 +1,78 @@
#import <Foundation/NSArray.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSError.h>
#import <Foundation/NSObject.h>
#import <Foundation/NSSet.h>
#import <Foundation/NSString.h>
#import <Foundation/NSValue.h>
@class SomeClassWithProperty;
NS_ASSUME_NONNULL_BEGIN
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunknown-warning-option"
#pragma clang diagnostic ignored "-Wincompatible-property-type"
#pragma clang diagnostic ignored "-Wnullability"
#pragma push_macro("_Nullable_result")
#if !__has_feature(nullability_nullable_result)
#undef _Nullable_result
#define _Nullable_result _Nullable
#endif
/**
* `Summary class` [KDocExport].
*
* @property xyzzy Doc for property xyzzy
* @property zzz See below.
*/
__attribute__((objc_subclassing_restricted))
@interface KDocExport : Base
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
/** Non-primary ctor KDoc:*/
- (instancetype)initWithName:(NSString *)name __attribute__((swift_name("init(name:)"))) __attribute__((objc_designated_initializer));
/** @property xyzzy KDoc for foo?*/
@property (readonly) NSString *foo __attribute__((swift_name("foo")));
/**
* @param xyzzy is documented.
*
* This is multi-line KDoc. See a blank line above.
*/
@property (readonly) NSString *xyzzy __attribute__((swift_name("xyzzy")));
/** @property foo KDoc for yxxyz?*/
@property int32_t yxxyz __attribute__((swift_name("yxxyz")));
@end
@interface SomeClassWithProperty : Base
- (instancetype)init __attribute__((swift_name("init()"))) __attribute__((objc_designated_initializer));
+ (instancetype)new __attribute__((availability(swift, unavailable, message="use object initializers instead")));
/**
* Kdoc for a property
*/
@property (readonly) SomeClassWithProperty *heavyFormattedKDocFoo __attribute__((swift_name("heavyFormattedKDocFoo")));
@end
__attribute__((objc_subclassing_restricted))
@interface FooKt : Base
/**
* Useless function [whatever]
*
* This kdoc has some additional formatting.
* @param a keep intact and return
* @return value of [a]
* Check for additional comment (note) below
*/
+ (NSString *)whateverA:(NSString *)a __attribute__((swift_name("whatever(a:)")));
@end
#pragma pop_macro("_Nullable_result")
#pragma clang diagnostic pop
NS_ASSUME_NONNULL_END
@@ -0,0 +1,52 @@
/*
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package kdocExport
/**
* `Summary class` [KDocExport].
*
* @property xyzzy Doc for property xyzzy
* @property zzz See below.
*/
// Expected: this comment shall not affect KDoc (i.e. kdoc above is still OK)
class KDocExport() {
/**
* @param xyzzy is documented.
*
* This is multi-line KDoc. See a blank line above.
*/
val xyzzy: String = "String example"
/** Non-primary ctor KDoc:*/
constructor(name: String) : this() {
println(name)
}
/** @property xyzzy KDoc for foo?*/
val foo = "foo"
/** @property foo KDoc for yxxyz?*/
var yxxyz = 0;
}
/**
* Useless function [whatever]
*
* This kdoc has some additional formatting.
* @param a keep intact and return
* @return value of [a]
* Check for additional comment (note) below
*/
fun whatever(a:String) = a
public abstract class SomeClassWithProperty
{
/**
* Kdoc for a property
*/
public abstract val heavyFormattedKDocFoo: SomeClassWithProperty
}