File: test-only-initialize-once.t

package info (click to toggle)
ppx-inline-test 0.17.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 364 kB
  • sloc: ml: 1,367; makefile: 15; javascript: 3; ansic: 2; sh: 2
file content (43 lines) | stat: -rw-r--r-- 1,845 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
This file tests the [init] function exposed by [Ppx_inline_test_lib]. We check
that the function can't be called if the test settings were already
initialized, either because the program is running from an
[inline_tests_runner] executable, or because [init] has already been called. We
also check that help, success, and error cases are reported correctly.

  $ cd $TEST_DIR

  $ ./inline_tests_runner
  The inline test runner can only be initialized once, and has already been initialized.

We'd rather not have the exact contents of the help text in the test output below, so we
filter out lines that start with two spaces.

  $ sample-client/inline_tests_sample_client.exe inline-test-runner dummy-lib -help | grep -vE '^  '
  (About to call [init] the first time)
  <Help>
  sample-client/inline_tests_sample_client.exe inline-test-runner dummy-lib [args]
  
  (About to call [init] the second time)
  <Error>
  The inline test runner can only be initialized once, and has already been initialized.
  (Was able to call [init] twice)

  $ sample-client/inline_tests_sample_client.exe inline-test-runner dummy-lib -list-partitions
  (About to call [init] the first time)
  <OK>
  (About to call [init] the second time)
  <Error>
  The inline test runner can only be initialized once, and has already been initialized.
  (Was able to call [init] twice)

  $ sample-client/inline_tests_sample_client.exe inline-test-runner dummy-lib -lst-prt | grep -vE '^  '
  (About to call [init] the first time)
  <Error>
  sample-client/inline_tests_sample_client.exe: unknown option '-lst-prt'.
  sample-client/inline_tests_sample_client.exe inline-test-runner dummy-lib [args]
  
  (About to call [init] the second time)
  <Error>
  The inline test runner can only be initialized once, and has already been initialized.
  (Was able to call [init] twice)