Skip to content

Commit

Permalink
Add URLEncode test
Browse files Browse the repository at this point in the history
  • Loading branch information
KIRSTEN W. HILDRUM committed Oct 4, 2015
1 parent 1988a97 commit ed3e8a4
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/tests.http/Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#
# *******************************************************************************
# * Copyright (C)2014, International Business Machines Corporation and *
# * Copyright (C)2014-2015, International Business Machines Corporation and *
# * others. All Rights Reserved. *
# *******************************************************************************
#
Expand All @@ -10,7 +10,7 @@ args=-t ../../com.ibm.streamsx.inet
ns=com.ibm.streamsx.inet.http.tests
outputdir=./output

tests=HTTPStreamBasicFunctionTestMain HTTPStreamBadUrlTestMain HTTPStreamConsistentRegionFailMain HTTPPostBasicFunctionTestMain HTTPPostConsistentRegionFailMain
tests=HTTPStreamBasicFunctionTestMain HTTPStreamBadUrlTestMain HTTPStreamConsistentRegionFailMain HTTPPostBasicFunctionTestMain HTTPPostConsistentRegionFailMain URLEncodeTestMain

rntest=./scripts/testRunner.sh
ftest=./scripts/expectFail.sh
Expand Down
33 changes: 33 additions & 0 deletions tests/tests.http/com.ibm.streamsx.inet.http.tests/URLEncode.spl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
namespace com.ibm.streamsx.inet.http.tests;
use com.ibm.streamsx.inet.http::urlEncode;
use com.ibm.streamsx.inet.http::urlDecode;

composite URLEncodeTestMain {

graph
() as tester = Custom() {

logic onProcess: {

rstring raw = "This has spaces and newline \n.";
//println(raw);
rstring encoded = urlEncode(raw);
//println(encoded);
rstring decoded = urlDecode(encoded);
if (decoded != raw) {
abort();
}
rstring raw2 = "This has a null \0 now stuff after the null";
//println(raw2);
rstring encoded2 = urlEncode(raw2);
//println(encoded2);
rstring decoded2 = urlDecode(encoded2);
if (raw2 != decoded2) {
abort();
}

}

}

}

0 comments on commit ed3e8a4

Please sign in to comment.