better assertion to ensure `base' is a valid base url

This commit is contained in:
Jocelyn Fiat
2011-09-21 15:30:20 +02:00
parent 458cb56f75
commit 33eddd9197
2 changed files with 9 additions and 1 deletions

View File

@@ -20,9 +20,11 @@ create
feature {NONE} -- Initialization
make_with_base (a_app: like application; a_base: like base)
require
a_base_starts_with_slash: (a_base /= Void and then not a_base.is_empty) implies a_base.starts_with ("/")
do
make (a_app)
base := a_base
set_base (a_base)
end
feature {NONE} -- Initialization
@@ -52,8 +54,12 @@ feature -- Access
feature -- Element change
set_base (b: like base)
require
b_starts_with_slash: (b /= Void and then not b.is_empty) implies b.starts_with ("/")
do
base := b
ensure
valid_base: (attached base as l_base and then not l_base.is_empty) implies l_base.starts_with ("/")
end
feature -- Server

View File

@@ -20,6 +20,8 @@ feature {NONE} -- Implementation
make_custom (a_callback: like {WGI_AGENT_APPLICATION}.callback; a_base_url: detachable STRING)
-- Initialize `Current'.
require
base_url_starts_with_slash: (a_base_url /= Void and then not a_base_url.is_empty) implies a_base_url.starts_with ("/")
local
app: WGI_AGENT_APPLICATION
do