PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 1ms

/test/lib/cli/test_cli_01.e

http://github.com/tybor/Liberty
Specman e | 60 lines | 43 code | 11 blank | 6 comment | 0 complexity | db08bc4d5d1bf0b846b13019ba973ba8 MD5 | raw file
 1class TEST_CLI_01
 2
 3insert
 4   ARGUMENTS
 5   EIFFELTEST_TOOLS
 6   COMMAND_LINE_ARGUMENT_FACTORY
 7
 8create {}
 9   make
10
11feature {}
12   make
13      do
14         -- the program takes no argument
15         create args.make(no_parameters)
16         args.set_helper(agent call_usage(?))
17
18         -- an empty command line is valid
19         setup
20         assert(args.parse_command_line)
21         assert(not usage_called)
22
23         -- an extra argument is not valid...
24         setup
25         command_arguments.add_last(once "foo")
26         assert(not args.parse_command_line)
27         assert(not usage_called)
28
29         -- ... except -h...
30         setup
31         command_arguments.add_last(once "-h")
32         assert(args.parse_command_line)
33         assert(usage_called)
34
35         -- ... and --help
36         setup
37      command_arguments.add_last(once "--help")
38      assert(args.parse_command_line)
39      assert(usage_called)
40      end
41
42   setup
43      do
44         command_arguments.make(1)
45         usage_called := False
46      end
47
48   args: COMMAND_LINE_ARGUMENTS
49
50   usage_called: BOOLEAN
51   call_usage (a_args: COMMAND_LINE_ARGUMENTS)
52      do
53         assert(a_args = args)
54         -- a_args.usage(std_output)
55         usage_called := True
56      ensure
57         usage_called
58      end
59
60end