-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
iTermPythonArgumentParserTests.m
77 lines (60 loc) · 2.72 KB
/
iTermPythonArgumentParserTests.m
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
//
// iTermPythonArgumentParserTests.m
// iTerm2XCTests
//
// Created by George Nachman on 11/14/19.
//
#import <XCTest/XCTest.h>
#import "iTermPythonArgumentParser.h"
@interface iTermPythonArgumentParserTests : XCTestCase
@end
@implementation iTermPythonArgumentParserTests
- (void)testStatement {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"-c", @"statement", @"script" ]];
XCTAssertEqualObjects(parser.statement, @"statement");
XCTAssertNil(parser.script);
}
- (void)testCompoundStatement {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"-cstatement", @"script" ]];
XCTAssertEqualObjects(parser.statement, @"statement");
XCTAssertNil(parser.script);
}
- (void)testModule {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"-m", @"module", @"arg" ]];
XCTAssertEqualObjects(parser.module, @"module arg");
XCTAssertNil(parser.script);
}
- (void)testCompoundModule {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"-mmodule", @"arg" ]];
XCTAssertEqualObjects(parser.module, @"module arg");
XCTAssertNil(parser.script);
}
- (void)testScript {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"script" ]];
XCTAssertEqualObjects(parser.script, @"script");
}
- (void)testIgnoresDivisionControl {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"-Q", @"old", @"script" ]];
XCTAssertEqualObjects(parser.script, @"script");
}
- (void)testIgnoresCompoundDivisionControl {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"-Qold", @"script" ]];
XCTAssertEqualObjects(parser.script, @"script");
}
- (void)testIgnoresWarningControl {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"-W", @"old", @"script" ]];
XCTAssertEqualObjects(parser.script, @"script");
}
- (void)testIgnoresCompoundWarningControl {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"-Wold", @"script" ]];
XCTAssertEqualObjects(parser.script, @"script");
}
- (void)testIgnoresArgv {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"-", @"argv" ]];
XCTAssertNil(parser.script);
}
- (void)testIgnoresUnrecognized {
iTermPythonArgumentParser *parser = [[iTermPythonArgumentParser alloc] initWithArgs:@[ @"python", @"-B", @"script" ]];
XCTAssertEqualObjects(parser.script, @"script");
}
@end