From 349cdeea326a0062959edca91ac1a91e55dabed8 Mon Sep 17 00:00:00 2001 From: Ming Li Date: Fri, 4 Aug 2023 23:35:17 +0200 Subject: [PATCH] Fixed smoke tests and adapted the expected output. Also removed the added functional test case since smoke test already covers it. --- .../functional/input/lime/CommentsLambda.lime | 9 --------- .../templates/dart/DartFunctionDocs.mustache | 19 ++----------------- .../templates/dart/DartLambda.mustache | 4 +++- .../output/cpp/include/smoke/Comments.h | 3 +++ .../cpp/include/smoke/ExcludedComments.h | 3 +++ .../cpp/include/smoke/ExcludedCommentsOnly.h | 4 ++++ .../output/dart/lib/src/smoke/comments.dart | 7 +++++++ .../dart/lib/src/smoke/excluded_comments.dart | 7 +++++++ .../output/swift/smoke/Comments.swift | 4 ++++ .../output/swift/smoke/ExcludedComments.swift | 4 ++++ .../swift/smoke/ExcludedCommentsOnly.swift | 5 +++++ .../output/cpp/include/smoke/Lambdas.h | 2 ++ .../output/dart/lib/src/smoke/lambdas.dart | 1 + .../lambdas/output/swift/smoke/Lambdas.swift | 2 ++ 14 files changed, 47 insertions(+), 27 deletions(-) delete mode 100644 functional-tests/functional/input/lime/CommentsLambda.lime diff --git a/functional-tests/functional/input/lime/CommentsLambda.lime b/functional-tests/functional/input/lime/CommentsLambda.lime deleted file mode 100644 index afa3192d37..0000000000 --- a/functional-tests/functional/input/lime/CommentsLambda.lime +++ /dev/null @@ -1,9 +0,0 @@ -package test - -class CommentsLambda { - // This is a comment for lambda - // @param[p0] This is the comment for the first parameter of the lambda. - // @param[p1] This is the comment for the second parameter of the lambda. - lambda MyCallback = (@Java("param1_name") Int?, @Java("param2_name") String) - -> /*Comment for return value*/ Int -} diff --git a/gluecodium/src/main/resources/templates/dart/DartFunctionDocs.mustache b/gluecodium/src/main/resources/templates/dart/DartFunctionDocs.mustache index 3c785f475f..807d7d6ac0 100644 --- a/gluecodium/src/main/resources/templates/dart/DartFunctionDocs.mustache +++ b/gluecodium/src/main/resources/templates/dart/DartFunctionDocs.mustache @@ -18,23 +18,8 @@ ! License-Filename: LICENSE ! !}} -{{#resolveName comment}}{{#unless this.isEmpty}}{{prefix this "/// "}} -///{{/unless}}{{/resolveName}}{{!! -}}{{#parameters}}{{#set self=this}}{{#resolveName comment}}{{#unless this.isEmpty}} -/// [{{resolveName self}}] {{prefix this "/// " skipFirstLine=true}} -///{{/unless}}{{/resolveName}}{{/set}}{{/parameters}}{{!! -}}{{#resolveName returnType.comment}}{{#unless this.isEmpty}} -/// Returns [{{resolveName returnType.typeRef}}]. {{prefix this "/// " skipFirstLine=true}} -///{{/unless}}{{/resolveName}}{{!! -}}{{#if thrownType}}{{#resolveName thrownType.comment}}{{#unless this.isEmpty}} -/// Throws [{{resolveName exception}}]. {{prefix this "/// " skipFirstLine=true}} -///{{/unless}}{{/resolveName}}{{/if}}{{!! -}}{{#ifPredicate "needsNoDoc"}} -/// @nodoc{{/ifPredicate}}{{!! -}}{{#if attributes.deprecated}} -@Deprecated("{{#resolveName attributes.deprecated.message}}{{escape this}}{{/resolveName}}") -{{/if}}{{!! -}}{{#if attributes.dart.attribute}} +{{>dart/DartLambdaDocs}} +{{#if attributes.dart.attribute}} {{#attributes.dart.attribute}} @{{this}}{{#if iter.hasNext}} diff --git a/gluecodium/src/main/resources/templates/dart/DartLambda.mustache b/gluecodium/src/main/resources/templates/dart/DartLambda.mustache index b4fea57a86..a148e82ede 100644 --- a/gluecodium/src/main/resources/templates/dart/DartLambda.mustache +++ b/gluecodium/src/main/resources/templates/dart/DartLambda.mustache @@ -18,7 +18,9 @@ ! License-Filename: LICENSE ! !}} -{{>dart/DartFunctionDocs}}{{>dart/DartAttributes}} +{{>dart/DartLambdaDocs}} + +{{>dart/DartAttributes}} typedef {{resolveName}} = {{>dart/DartLambdaType}}; // {{resolveName}} "private" section, not exported. diff --git a/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/Comments.h b/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/Comments.h index aeb401b2d1..3d87057010 100644 --- a/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/Comments.h +++ b/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/Comments.h @@ -34,6 +34,9 @@ class _GLUECODIUM_CPP_EXPORT Comments { }; /** * This is some very useful lambda that does it. + * \param[in] ::std::string Very useful input parameter + * \param[in] int32_t Slightly less useful input parameter + * \return Usefulness of the input */ using SomeLambda = ::std::function; /** diff --git a/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/ExcludedComments.h b/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/ExcludedComments.h index abe7b9f2ec..78c160ab88 100644 --- a/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/ExcludedComments.h +++ b/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/ExcludedComments.h @@ -33,6 +33,9 @@ class _GLUECODIUM_CPP_EXPORT ExcludedComments { /** * This is some very useful lambda that does it. * \private + * \param[in] ::std::string Very useful input parameter + * \param[in] int32_t Slightly less useful input parameter + * \return Usefulness of the input */ using SomeLambda = ::std::function; /** diff --git a/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/ExcludedCommentsOnly.h b/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/ExcludedCommentsOnly.h index a1b13ecf7e..f30650c059 100644 --- a/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/ExcludedCommentsOnly.h +++ b/gluecodium/src/test/resources/smoke/comments/output/cpp/include/smoke/ExcludedCommentsOnly.h @@ -28,7 +28,11 @@ class _GLUECODIUM_CPP_EXPORT ExcludedCommentsOnly { USELESS }; /** + * * \private + * \param[in] ::std::string + * \param[in] int32_t + * \return */ using SomeLambda = ::std::function; /** diff --git a/gluecodium/src/test/resources/smoke/comments/output/dart/lib/src/smoke/comments.dart b/gluecodium/src/test/resources/smoke/comments/output/dart/lib/src/smoke/comments.dart index 761f9578d1..97352521b3 100644 --- a/gluecodium/src/test/resources/smoke/comments/output/dart/lib/src/smoke/comments.dart +++ b/gluecodium/src/test/resources/smoke/comments/output/dart/lib/src/smoke/comments.dart @@ -232,6 +232,13 @@ void smokeCommentsSomestructReleaseFfiHandleNullable(Pointer handle) => _smokeCommentsSomestructReleaseHandleNullable(handle); // End of Comments_SomeStruct "private" section. /// This is some very useful lambda that does it. +/// +/// [String] Very useful input parameter +/// +/// [int] Slightly less useful input parameter +/// +/// Returns [double]. Usefulness of the input +/// typedef Comments_SomeLambda = double Function(String, int); // Comments_SomeLambda "private" section, not exported. final _smokeCommentsSomelambdaRegisterFinalizer = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction< diff --git a/gluecodium/src/test/resources/smoke/comments/output/dart/lib/src/smoke/excluded_comments.dart b/gluecodium/src/test/resources/smoke/comments/output/dart/lib/src/smoke/excluded_comments.dart index fbb01533a8..f6e8a9bff9 100644 --- a/gluecodium/src/test/resources/smoke/comments/output/dart/lib/src/smoke/excluded_comments.dart +++ b/gluecodium/src/test/resources/smoke/comments/output/dart/lib/src/smoke/excluded_comments.dart @@ -164,6 +164,13 @@ void smokeExcludedcommentsSomestructReleaseFfiHandleNullable(Pointer handl _smokeExcludedcommentsSomestructReleaseHandleNullable(handle); // End of ExcludedComments_SomeStruct "private" section. /// This is some very useful lambda that does it. +/// +/// [String] Very useful input parameter +/// +/// [int] Slightly less useful input parameter +/// +/// Returns [double]. Usefulness of the input +/// /// @nodoc typedef ExcludedComments_SomeLambda = double Function(String, int); // ExcludedComments_SomeLambda "private" section, not exported. diff --git a/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/Comments.swift b/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/Comments.swift index d6790bd2b3..3d8267c1f2 100644 --- a/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/Comments.swift +++ b/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/Comments.swift @@ -8,6 +8,10 @@ public class Comments { /// This is some very useful exception. public typealias SomethingWrongError = Comments.SomeEnum /// This is some very useful lambda that does it. + /// - Parameters: + /// - String: Very useful input parameter + /// - Int32: Slightly less useful input parameter + /// - Returns: Usefulness of the input public typealias SomeLambda = (String, Int32) -> Double /// This is some very useful constant. public static let veryUseful: Comments.Usefulness = true diff --git a/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/ExcludedComments.swift b/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/ExcludedComments.swift index 6acaa1ad16..c480852561 100644 --- a/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/ExcludedComments.swift +++ b/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/ExcludedComments.swift @@ -11,6 +11,10 @@ public class ExcludedComments { /// :nodoc: public typealias SomethingWrongError = ExcludedComments.SomeEnum /// This is some very useful lambda that does it. + /// - Parameters: + /// - String: Very useful input parameter + /// - Int32: Slightly less useful input parameter + /// - Returns: Usefulness of the input /// :nodoc: public typealias SomeLambda = (String, Int32) -> Double /// This is some very useful constant. diff --git a/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/ExcludedCommentsOnly.swift b/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/ExcludedCommentsOnly.swift index 4823c02481..a98b250171 100644 --- a/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/ExcludedCommentsOnly.swift +++ b/gluecodium/src/test/resources/smoke/comments/output/swift/smoke/ExcludedCommentsOnly.swift @@ -7,6 +7,11 @@ public class ExcludedCommentsOnly { public typealias Usefulness = Bool /// :nodoc: public typealias SomethingWrongError = ExcludedCommentsOnly.SomeEnum + /// + /// - Parameters: + /// - String: + /// - Int32: + /// - Returns: /// :nodoc: public typealias SomeLambda = (String, Int32) -> Double /// :nodoc: diff --git a/gluecodium/src/test/resources/smoke/lambdas/output/cpp/include/smoke/Lambdas.h b/gluecodium/src/test/resources/smoke/lambdas/output/cpp/include/smoke/Lambdas.h index 594d9f7801..21de75a9d5 100644 --- a/gluecodium/src/test/resources/smoke/lambdas/output/cpp/include/smoke/Lambdas.h +++ b/gluecodium/src/test/resources/smoke/lambdas/output/cpp/include/smoke/Lambdas.h @@ -21,6 +21,8 @@ class _GLUECODIUM_CPP_EXPORT Lambdas { using Producer = ::std::function<::std::string()>; /** * Should confuse everyone thoroughly + * \param[in] ::std::string + * \return */ using Confuser = ::std::function<::smoke::Lambdas::Producer(const ::std::string&)>; using Consumer = ::std::function; diff --git a/gluecodium/src/test/resources/smoke/lambdas/output/dart/lib/src/smoke/lambdas.dart b/gluecodium/src/test/resources/smoke/lambdas/output/dart/lib/src/smoke/lambdas.dart index 4c27a97077..ec54d00d8c 100644 --- a/gluecodium/src/test/resources/smoke/lambdas/output/dart/lib/src/smoke/lambdas.dart +++ b/gluecodium/src/test/resources/smoke/lambdas/output/dart/lib/src/smoke/lambdas.dart @@ -101,6 +101,7 @@ void smokeLambdasProducerReleaseFfiHandleNullable(Pointer handle) => _smokeLambdasProducerReleaseHandleNullable(handle); // End of Lambdas_Producer "private" section. /// Should confuse everyone thoroughly +/// typedef Lambdas_Confuser = Lambdas_Producer Function(String); // Lambdas_Confuser "private" section, not exported. final _smokeLambdasConfuserRegisterFinalizer = __lib.catchArgumentError(() => __lib.nativeLibrary.lookupFunction< diff --git a/gluecodium/src/test/resources/smoke/lambdas/output/swift/smoke/Lambdas.swift b/gluecodium/src/test/resources/smoke/lambdas/output/swift/smoke/Lambdas.swift index 011699056d..234845ff8e 100644 --- a/gluecodium/src/test/resources/smoke/lambdas/output/swift/smoke/Lambdas.swift +++ b/gluecodium/src/test/resources/smoke/lambdas/output/swift/smoke/Lambdas.swift @@ -4,6 +4,8 @@ import Foundation public class Lambdas { public typealias Producer = () -> String /// Should confuse everyone thoroughly + /// - Parameter String: + /// - Returns: public typealias Convoluter = (String) -> Lambdas.Producer public typealias Consumer = (String) -> Void public typealias Indexer = (String, Float) -> Int32