Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
27 lines
990 B
C++
27 lines
990 B
C++
// SPDX-License-Identifier: MPL-2.0
|
|
//
|
|
// Tests de la validation des URL avant ouverture du navigateur. Aucun navigateur n'est
|
|
// réellement ouvert.
|
|
#include "sequa/studio/host/browser.hpp"
|
|
|
|
#include <doctest/doctest.h>
|
|
|
|
using namespace sequa::studio::host;
|
|
|
|
TEST_CASE("Web : is_openable_url n'accepte que http et https")
|
|
{
|
|
CHECK(is_openable_url("http://127.0.0.1:9080/?core=x"));
|
|
CHECK(is_openable_url("https://example.com/chemin?x=1#f"));
|
|
CHECK(is_openable_url("HTTP://EXAMPLE.COM/"));
|
|
CHECK(is_openable_url("HtTpS://example.com/"));
|
|
|
|
CHECK_FALSE(is_openable_url(""));
|
|
CHECK_FALSE(is_openable_url("file:///C:/Windows/win.ini"));
|
|
CHECK_FALSE(is_openable_url("javascript:alert(1)"));
|
|
CHECK_FALSE(is_openable_url("ftp://example.com/"));
|
|
CHECK_FALSE(is_openable_url("http:/pas-de-double-slash"));
|
|
CHECK_FALSE(is_openable_url("http://x\ncommande"));
|
|
CHECK_FALSE(is_openable_url("http://x\ttab"));
|
|
CHECK_FALSE(is_openable_url("http://\x01"));
|
|
}
|