Skip to content

Commit 82f578d

Browse files
committed
Adjusted tests for TokenPartitioner 📎
1 parent b406883 commit 82f578d

4 files changed

Lines changed: 14 additions & 10 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ type options = {
112112
```
113113
Consume them:
114114
```fsharp
115-
let main argv =
115+
let main argv =
116116
let result = CommandLine.Parser.Default.ParseArguments<options>(argv)
117117
match result with
118118
| :? Parsed<options> as parsed -> run parsed.Value
@@ -255,6 +255,7 @@ Latest Changes:
255255
- Issue #225/b (reported by @rmunn) Fixed.
256256
- All `ParserResult<T>.Return` renamed to `MapResult`.
257257
- PR #227 (by @Thilas) Merged.
258+
- Reverted back to `Tuple<...>` instead of `TokePartitions` type.
258259

259260
Contact:
260261
---

docs/ChangeLog

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
2015-08-24 Giacomo Stelluti Scala <[email protected]>
22

3-
* PR #227 (by @Thilas) Merged.
3+
* PR #227 (by @Thilas) Merged.
4+
* Reverted back to Tuple<...> instead of TokePartitions type.
45

56
2015-08-20 Giacomo Stelluti Scala <[email protected]>
67

7-
* All ParserResult<T>.Return renamed to MapResult.
8+
* All ParserResult<T>.Return renamed to MapResult.
89

910
2015-08-19 Giacomo Stelluti Scala <[email protected]>
1011

11-
* Issue #225 (reported by @rmunn) Fixed.
12-
* Issue #225/b (reported by @rmunn) Fixed.
12+
* Issue #225 (reported by @rmunn) Fixed.
13+
* Issue #225/b (reported by @rmunn) Fixed.
1314

1415
2015-08-15 Giacomo Stelluti Scala <[email protected]>
1516

src/CommandLine/Core/TokenPartitioner.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ static class TokenPartitioner
1111
{
1212
public static
1313
Tuple<
14-
IEnumerable<KeyValuePair<string, IEnumerable<string>>>,
15-
IEnumerable<string>,
16-
IEnumerable<Token>
14+
IEnumerable<KeyValuePair<string, IEnumerable<string>>>, // options
15+
IEnumerable<string>, // values
16+
IEnumerable<Token> // errors
1717
> Partition(
1818
IEnumerable<Token> tokens,
1919
Func<string, Maybe<TypeDescriptor>> typeLookup)

tests/CommandLine.Tests/Unit/Core/TokenPartitionerTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public void Partition_sequence_returns_sequence()
3232
);
3333

3434
// Verify outcome
35-
Assert.True(expectedSequence.All(a => result.Options.Any(r => a.Key.Equals(r.Key) && a.Value.SequenceEqual(r.Value))));
35+
var options = result.Item1;
36+
Assert.True(expectedSequence.All(a => options.Any(r => a.Key.Equals(r.Key) && a.Value.SequenceEqual(r.Value))));
3637

3738
// Teardown
3839
}
@@ -58,7 +59,8 @@ public void Partition_sequence_returns_sequence_with_duplicates()
5859
);
5960

6061
// Verify outcome
61-
Assert.True(expectedSequence.All(a => result.Options.Any(r => a.Key.Equals(r.Key) && a.Value.SequenceEqual(r.Value))));
62+
var options = result.Item1;
63+
Assert.True(expectedSequence.All(a => options.Any(r => a.Key.Equals(r.Key) && a.Value.SequenceEqual(r.Value))));
6264

6365
// Teardown
6466
}

0 commit comments

Comments
 (0)