QCKDSL.m 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #import "QCKDSL.h"
  2. #if __has_include("Quick-Swift.h")
  3. #import "Quick-Swift.h"
  4. #else
  5. #import <Quick/Quick-Swift.h>
  6. #endif
  7. void qck_beforeSuite(QCKDSLEmptyBlock closure) {
  8. [[World sharedWorld] beforeSuite:closure];
  9. }
  10. void qck_afterSuite(QCKDSLEmptyBlock closure) {
  11. [[World sharedWorld] afterSuite:closure];
  12. }
  13. void qck_sharedExamples(NSString *name, QCKDSLSharedExampleBlock closure) {
  14. [[World sharedWorld] sharedExamples:name closure:closure];
  15. }
  16. void qck_describe(NSString *description, QCKDSLEmptyBlock closure) {
  17. [[World sharedWorld] describe:description flags:@{} closure:closure];
  18. }
  19. void qck_context(NSString *description, QCKDSLEmptyBlock closure) {
  20. qck_describe(description, closure);
  21. }
  22. void qck_beforeEach(QCKDSLEmptyBlock closure) {
  23. [[World sharedWorld] beforeEach:closure];
  24. }
  25. void qck_beforeEachWithMetadata(QCKDSLExampleMetadataBlock closure) {
  26. [[World sharedWorld] beforeEachWithMetadata:closure];
  27. }
  28. void qck_afterEach(QCKDSLEmptyBlock closure) {
  29. [[World sharedWorld] afterEach:closure];
  30. }
  31. void qck_afterEachWithMetadata(QCKDSLExampleMetadataBlock closure) {
  32. [[World sharedWorld] afterEachWithMetadata:closure];
  33. }
  34. QCKItBlock qck_it_builder(NSDictionary *flags, NSString *file, NSUInteger line) {
  35. return ^(NSString *description, QCKDSLEmptyBlock closure) {
  36. [[World sharedWorld] itWithDescription:description
  37. flags:flags
  38. file:file
  39. line:line
  40. closure:closure];
  41. };
  42. }
  43. QCKItBehavesLikeBlock qck_itBehavesLike_builder(NSDictionary *flags, NSString *file, NSUInteger line) {
  44. return ^(NSString *name, QCKDSLSharedExampleContext context) {
  45. [[World sharedWorld] itBehavesLikeSharedExampleNamed:name
  46. sharedExampleContext:context
  47. flags:flags
  48. file:file
  49. line:line];
  50. };
  51. }
  52. void qck_pending(NSString *description, QCKDSLEmptyBlock closure) {
  53. [[World sharedWorld] pending:description closure:closure];
  54. }
  55. void qck_xdescribe(NSString *description, QCKDSLEmptyBlock closure) {
  56. [[World sharedWorld] xdescribe:description flags:@{} closure:closure];
  57. }
  58. void qck_xcontext(NSString *description, QCKDSLEmptyBlock closure) {
  59. qck_xdescribe(description, closure);
  60. }
  61. void qck_fdescribe(NSString *description, QCKDSLEmptyBlock closure) {
  62. [[World sharedWorld] fdescribe:description flags:@{} closure:closure];
  63. }
  64. void qck_fcontext(NSString *description, QCKDSLEmptyBlock closure) {
  65. qck_fdescribe(description, closure);
  66. }