3 # An exercise in combinatorics.
4 # (ordinary/static function, member function, std::function, lambda)
6 # returns (Future<R>, R)
8 # accepts (Try<T>&&, Try<T> const&, Try<T>, T&&, T const&, T, nothing)
11 args = args.join(", ")
13 "{Future<B> f = someFuture<A>().then(#{args});}",
14 #"{Future<B> f = makeFuture(A()).then(#{args}, anExecutor);}",
20 "Future<B>" => "someFuture<B>()",
21 "Try<B>" => "Try<B>(B())",
44 return_types.map { |ret|
45 param_types.map { |param|
46 both = "#{ret}, #{param}"
48 ["aFunction<#{both}>"],
49 ["&SomeClass::aStaticMethod<#{both}>"],
50 # TODO switch these around (std::bind-style)
51 ["&anObject", "&SomeClass::aMethod<#{both}>"],
52 ["aStdFunction<#{both}>()"],
53 ["[&](#{param}){return #{retval(ret)};}"],
59 ).map {|a| test(a)}.flatten
62 // This file is #{"@"}generated by thens.rb
64 #include <folly/wangle/test/Thens.h>
66 TEST(Future, thenVariants) {