Commit 7fd0c781f5a542c6d4626328089956ed25b7320e

Remaining tests for QStringx. Two ones still fail, but imho that's not due to the tests. *fixing*
  
6060
6161void TestQStringx::testNamedArgs()
6262{
63 QMap<QString, QString> testArgs;
64
65 m_testString = "";
66 QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "" ) );
67
68 m_testString = "test";
69 QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "test" ) );
70
71 testArgs[ "artist" ] = "Pornophonique";
72 m_testString = "test";
73 QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "test" ) );
74
75 m_testString = "artist: %artist";
76 QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "artist: Pornophonique" ) );
77
78 m_testString = "artist: %artist - %album";
79 QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "artist: Pornophonique - " ) );
80
81 testArgs[ "album" ] = "8-Bit Lagerfeuer";
82 QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "artist: Pornophonique - 8-Bit Lagerfeuer" ) );
83
84 m_testString = "%artist: %artist - %album";
85 QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "Pornophonique: Pornophonique - 8-Bit Lagerfeuer" ) );
86
87 testArgs[ "year" ] = "2007";
88 QCOMPARE( m_testString.namedArgs( testArgs ) , QString( "Pornophonique: Pornophonique - 8-Bit Lagerfeuer" ) );
6389}
6490
6591void TestQStringx::testNamedOptArgs()
6692{
93 QMap<QString, QString> testArgs;
94
95 m_testString = "";
96 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) );
97
98 m_testString = "test";
99 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "test" ) );
100
101 m_testString = "%test";
102 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) );
103
104 m_testString = "{ %test }";
105 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) );
106
107 m_testString = "test{%test}";
108 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "test" ) );
109
110 m_testString = "{test{%test}}";
111 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "{test}" ) );
112
113 m_testString = "%test{%test}";
114 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) );
115
116 m_testString = "test%test ";
117 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "test " ) );
118
119 testArgs[ "artist" ] = "All:My:Faults";
120 m_testString = "%artist";
121 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "All:My:Faults" ) );
122
123 m_testString = "{%test }{%artist}";
124 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "All:My:Faults" ) );
125
126 m_testString = "{%test {%artist}}";
127 QCOMPARE( m_testString.namedOptArgs( testArgs ) , QString( "" ) );
67128}