Change structure of EWF, to follow better categorization

This commit is contained in:
Jocelyn Fiat
2012-06-13 22:32:17 +02:00
parent 3df1a26220
commit db448001a1
134 changed files with 105 additions and 94 deletions

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<system xmlns="http://www.eiffel.com/developers/xml/configuration-1-9-0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.eiffel.com/developers/xml/configuration-1-9-0 http://www.eiffel.com/developers/xml/configuration-1-9-0.xsd" name="test_http_client" uuid="920E5C50-41E1-4DAC-8D48-D9C860E49228">
<target name="test_http_client">
<root class="TEST" feature="make"/>
<file_rule>
<exclude>/.git$</exclude>
<exclude>/EIFGENs$</exclude>
<exclude>/.svn$</exclude>
</file_rule>
<option warning="true" full_class_checking="true" is_attached_by_default="true" void_safety="all">
<assertions precondition="true"/>
</option>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="http_client" location="..\http_client-safe.ecf" readonly="false"/>
<library name="testing" location="$ISE_LIBRARY\library\testing\testing-safe.ecf"/>
<tests name="tests" location=".\"/>
</target>
</system>

View File

@@ -0,0 +1,50 @@
class TEST
create
make
feature -- Init
make
do
test_http_client
end
test_http_client
-- New test routine
local
sess: LIBCURL_HTTP_CLIENT_SESSION
h: STRING_8
do
create sess.make ("http://www.google.com")
if attached sess.get ("/search?q=eiffel", Void) as res then
assert ("Get returned without error", not res.error_occurred)
create h.make_empty
if attached res.headers as hds then
across
hds as c
loop
h.append (c.item.name + ": " + c.item.value + "%R%N")
end
end
if attached res.body as l_body then
assert ("body not empty", not l_body.is_empty)
end
assert ("same headers", h.same_string (res.raw_header))
else
assert ("Not found", False)
end
end
assert (m: READABLE_STRING_8; b: BOOLEAN)
local
e: DEVELOPER_EXCEPTION
do
if not b then
create e
e.set_message (m)
e.raise
end
end
end

View File

@@ -0,0 +1,92 @@
note
description: "[
Eiffel tests that can be executed by testing tool.
]"
author: "EiffelStudio test wizard"
date: "$Date$"
revision: "$Revision$"
testing: "type/manual"
class
TEST_HTTP_CLIENT
inherit
EQA_TEST_SET
feature -- Test routines
test_http_client
-- New test routine
local
sess: LIBCURL_HTTP_CLIENT_SESSION
h: STRING_8
do
create sess.make ("http://www.google.com")
if attached sess.get ("/search?q=eiffel", Void) as res then
assert ("Get returned without error", not res.error_occurred)
create h.make_empty
if attached res.headers as hds then
across
hds as c
loop
h.append (c.item.name + ": " + c.item.value + "%R%N")
end
end
if attached res.body as l_body then
assert ("body not empty", not l_body.is_empty)
else
assert ("missing body", False)
end
assert ("same headers", h.same_string (res.raw_header))
else
assert ("Not found", False)
end
end
test_headers
local
res: HTTP_CLIENT_RESPONSE
h: STRING
do
create res.make
create h.make_empty
h.append ("normal: NORMAL%R%N")
h.append ("concat: ABC%R%N")
h.append ("concat: DEF%R%N")
h.append ("key1: KEY%R%N")
h.append (" key2 : KEY%R%N")
h.append (" %T key3 : KEY%R%N")
h.append ("value1:VALUE%R%N")
h.append ("value2: VALUE%R%N")
h.append ("value3: VALUE%R%N")
h.append ("value4: VALUE %R%N")
h.append (" %Tfoo : BAR%T %R%N")
res.set_raw_header (h)
create h.make_empty
if attached res.headers as hds then
across
hds as c
loop
h.append (c.item.name + ": " + c.item.value + "%N")
end
end
assert ("Expected headers map", h.same_string (
"[
normal: NORMAL
concat: ABC
concat: DEF
key1: KEY
key2: KEY
key3: KEY
value1: VALUE
value2: VALUE
value3: VALUE
value4: VALUE
foo: BAR
]"))
end
end