blob: f118c84b0580faebd502ae875604c06586528a0d [file] [log] [blame]
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<doxygen xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="compound.xsd" version="1.9.8" xml:lang="en-US">
<compounddef id="location__util__test_8cc" kind="file" language="C++">
<compoundname>location_util_test.cc</compoundname>
<includes refid="location__util_8h" local="yes">iceberg/util/location_util.h</includes>
<includes local="no">gtest/gtest.h</includes>
<incdepgraph>
<node id="4">
<label>iceberg/iceberg_export.h</label>
<link refid="iceberg__export_8h_source"/>
</node>
<node id="1">
<label>iceberg/test/location_util_test.cc</label>
<link refid="location__util__test_8cc"/>
<childnode refid="2" relation="include">
</childnode>
<childnode refid="5" relation="include">
</childnode>
</node>
<node id="2">
<label>iceberg/util/location_util.h</label>
<link refid="location__util_8h_source"/>
<childnode refid="3" relation="include">
</childnode>
<childnode refid="4" relation="include">
</childnode>
</node>
<node id="5">
<label>gtest/gtest.h</label>
</node>
<node id="3">
<label>string_view</label>
</node>
</incdepgraph>
<innernamespace refid="namespaceiceberg">iceberg</innernamespace>
<briefdescription>
</briefdescription>
<detaileddescription>
</detaileddescription>
<programlisting>
<codeline lineno="1"><highlight class="comment">/*</highlight></codeline>
<codeline lineno="2"><highlight class="comment"><sp/>*<sp/>Licensed<sp/>to<sp/>the<sp/>Apache<sp/>Software<sp/>Foundation<sp/>(ASF)<sp/>under<sp/>one</highlight></codeline>
<codeline lineno="3"><highlight class="comment"><sp/>*<sp/>or<sp/>more<sp/>contributor<sp/>license<sp/>agreements.<sp/><sp/>See<sp/>the<sp/>NOTICE<sp/>file</highlight></codeline>
<codeline lineno="4"><highlight class="comment"><sp/>*<sp/>distributed<sp/>with<sp/>this<sp/>work<sp/>for<sp/>additional<sp/>information</highlight></codeline>
<codeline lineno="5"><highlight class="comment"><sp/>*<sp/>regarding<sp/>copyright<sp/>ownership.<sp/><sp/>The<sp/>ASF<sp/>licenses<sp/>this<sp/>file</highlight></codeline>
<codeline lineno="6"><highlight class="comment"><sp/>*<sp/>to<sp/>you<sp/>under<sp/>the<sp/>Apache<sp/>License,<sp/>Version<sp/>2.0<sp/>(the</highlight></codeline>
<codeline lineno="7"><highlight class="comment"><sp/>*<sp/>&quot;License&quot;);<sp/>you<sp/>may<sp/>not<sp/>use<sp/>this<sp/>file<sp/>except<sp/>in<sp/>compliance</highlight></codeline>
<codeline lineno="8"><highlight class="comment"><sp/>*<sp/>with<sp/>the<sp/>License.<sp/><sp/>You<sp/>may<sp/>obtain<sp/>a<sp/>copy<sp/>of<sp/>the<sp/>License<sp/>at</highlight></codeline>
<codeline lineno="9"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="10"><highlight class="comment"><sp/>*<sp/><sp/><sp/>http://www.apache.org/licenses/LICENSE-2.0</highlight></codeline>
<codeline lineno="11"><highlight class="comment"><sp/>*</highlight></codeline>
<codeline lineno="12"><highlight class="comment"><sp/>*<sp/>Unless<sp/>required<sp/>by<sp/>applicable<sp/>law<sp/>or<sp/>agreed<sp/>to<sp/>in<sp/>writing,</highlight></codeline>
<codeline lineno="13"><highlight class="comment"><sp/>*<sp/>software<sp/>distributed<sp/>under<sp/>the<sp/>License<sp/>is<sp/>distributed<sp/>on<sp/>an</highlight></codeline>
<codeline lineno="14"><highlight class="comment"><sp/>*<sp/>&quot;AS<sp/>IS&quot;<sp/>BASIS,<sp/>WITHOUT<sp/>WARRANTIES<sp/>OR<sp/>CONDITIONS<sp/>OF<sp/>ANY</highlight></codeline>
<codeline lineno="15"><highlight class="comment"><sp/>*<sp/>KIND,<sp/>either<sp/>express<sp/>or<sp/>implied.<sp/><sp/>See<sp/>the<sp/>License<sp/>for<sp/>the</highlight></codeline>
<codeline lineno="16"><highlight class="comment"><sp/>*<sp/>specific<sp/>language<sp/>governing<sp/>permissions<sp/>and<sp/>limitations</highlight></codeline>
<codeline lineno="17"><highlight class="comment"><sp/>*<sp/>under<sp/>the<sp/>License.</highlight></codeline>
<codeline lineno="18"><highlight class="comment"><sp/>*/</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="19"><highlight class="normal"></highlight></codeline>
<codeline lineno="20"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&quot;iceberg/util/location_util.h&quot;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="21"><highlight class="normal"></highlight></codeline>
<codeline lineno="22"><highlight class="normal"></highlight><highlight class="preprocessor">#include<sp/>&lt;gtest/gtest.h&gt;</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="23"><highlight class="normal"></highlight></codeline>
<codeline lineno="24"><highlight class="normal"></highlight><highlight class="keyword">namespace<sp/></highlight><highlight class="normal">iceberg<sp/>{</highlight></codeline>
<codeline lineno="25"><highlight class="normal"></highlight></codeline>
<codeline lineno="26"><highlight class="normal">TEST(LocationUtilTest,<sp/>StripTrailingSlash)<sp/>{</highlight></codeline>
<codeline lineno="27"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Test<sp/>normal<sp/>paths<sp/>with<sp/>trailing<sp/>slashes</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="28"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;/path/to/dir&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;/path/to/dir/&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="29"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;/path/to/dir&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;/path/to/dir//&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="30"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;/path/to/dir&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;/path/to/dir///&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="31"><highlight class="normal"></highlight></codeline>
<codeline lineno="32"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Test<sp/>paths<sp/>without<sp/>trailing<sp/>slashes</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="33"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;/path/to/dir&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;/path/to/dir&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="34"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;/path/to/file.txt&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;/path/to/file.txt&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="35"><highlight class="normal"></highlight></codeline>
<codeline lineno="36"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Test<sp/>root<sp/>path</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="37"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;/&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="38"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;//&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="39"><highlight class="normal"></highlight></codeline>
<codeline lineno="40"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Test<sp/>empty<sp/>string</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="41"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="42"><highlight class="normal"></highlight></codeline>
<codeline lineno="43"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Test<sp/>URLs<sp/>with<sp/>protocols</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="44"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;http://example.com&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="45"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;http://example.com/&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="46"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;https://example.com/path&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="47"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;https://example.com/path/&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="48"><highlight class="normal"></highlight></codeline>
<codeline lineno="49"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Test<sp/>that<sp/>protocol<sp/>endings<sp/>are<sp/>preserved</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="50"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;http://&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;http://&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="51"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;https://&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;https://&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="52"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;s3://&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;s3://&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="53"><highlight class="normal"></highlight></codeline>
<codeline lineno="54"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Test<sp/>paths<sp/>with<sp/>protocol-like<sp/>substrings<sp/>in<sp/>the<sp/>middle</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="55"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;/path/http://test&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;/path/http://test/&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="56"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;/path/https://test&quot;</highlight><highlight class="normal">,</highlight></codeline>
<codeline lineno="57"><highlight class="normal"><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/><sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;/path/https://test/&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="58"><highlight class="normal"></highlight></codeline>
<codeline lineno="59"><highlight class="normal"><sp/><sp/></highlight><highlight class="comment">//<sp/>Test<sp/>multiple<sp/>slashes<sp/>not<sp/>at<sp/>the<sp/>end</highlight><highlight class="normal"></highlight></codeline>
<codeline lineno="60"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;/path//to/dir&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;/path//to/dir/&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="61"><highlight class="normal"><sp/><sp/>ASSERT_EQ(</highlight><highlight class="stringliteral">&quot;/path///to/dir&quot;</highlight><highlight class="normal">,<sp/>LocationUtil::StripTrailingSlash(</highlight><highlight class="stringliteral">&quot;/path///to/dir/&quot;</highlight><highlight class="normal">));</highlight></codeline>
<codeline lineno="62"><highlight class="normal">}</highlight></codeline>
<codeline lineno="63"><highlight class="normal"></highlight></codeline>
<codeline lineno="64"><highlight class="normal">}<sp/><sp/></highlight><highlight class="comment">//<sp/>namespace<sp/>iceberg</highlight><highlight class="normal"></highlight></codeline>
</programlisting>
<location file="iceberg/test/location_util_test.cc"/>
</compounddef>
</doxygen>