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
78
79
80
81
82
83
84
85
86
87
88
89
|
using NUnit.Framework;
using System.Collections.Generic;
namespace Mono.Linker.Tests
{
[TestFixture]
public class ParseResponseFileLinesTests
{
[Test]
public void TestOneArg ()
{
TestParseResponseFileLines (@"abc", new string[] { @"abc" });
}
[Test]
public void TestTwoArgsOnOneLine ()
{
TestParseResponseFileLines (@"abc def", new string[] { @"abc", @"def" });
}
[Test]
public void TestTwoArgsOnTwoLine ()
{
TestParseResponseFileLines (@"abc
def", new string[] { @"abc", @"def" });
}
[Test]
public void TestOneSlashWithoutQuote ()
{
TestParseResponseFileLines (@"\", new string[] { @"\" });
}
[Test]
public void TestTwoSlashesWithoutQuote ()
{
TestParseResponseFileLines (@"\\", new string[] { @"\\" });
}
[Test]
public void TestOneSlashWithQuote ()
{
TestParseResponseFileLines (@"""x \"" y""", new string[] { @"x "" y" });
}
[Test]
public void TestTwoSlashesWithQuote ()
{
TestParseResponseFileLines (@"""Trailing Slash\\""", new string[] { @"Trailing Slash\" });
}
[Test]
public void TestWindowsPath ()
{
TestParseResponseFileLines (@"C:\temp\test.txt", new string[] { @"C:\temp\test.txt" });
}
[Test]
public void TestLinuxPath ()
{
TestParseResponseFileLines (@"/tmp/test.txt", new string[] { @"/tmp/test.txt" });
}
[Test]
public void TestEqualsArguments ()
{
TestParseResponseFileLines (@"a=b", new string[] { @"a=b" });
}
[Test]
public void TestEqualsArgumentsSpaces ()
{
TestParseResponseFileLines (@"a=""b c""", new string[] { @"a=b c" });
}
[Test]
public void TestEqualsKeySpaces ()
{
TestParseResponseFileLines (@"""a b""=c", new string[] { @"a b=c" });
}
private void TestParseResponseFileLines (string v1, string[] v2)
{
var result = new Queue<string> ();
Driver.ParseResponseFileLines (v1.Split ('\n'), result);
Assert.That (result, Is.EquivalentTo (v2));
}
}
}
|