mirror of
https://github.com/jezhiggins/arabica
synced 2024-11-17 07:48:50 +01:00
Fixed Variable look up by QName
This commit is contained in:
parent
6a95d42dd6
commit
4f490d6d38
3 changed files with 254 additions and 1 deletions
|
@ -159,7 +159,7 @@ public:
|
|||
{
|
||||
typedef Arabica::text::Unicode<typename string_adaptor::value_type> UnicodeT;
|
||||
|
||||
string_type clarkName = namespace_uri.empty() ? name : UnicodeT::LEFT_SQUARE_BRACKET + namespace_uri + UnicodeT::RIGHT_SQUARE_BRACKET + name;
|
||||
string_type clarkName = namespace_uri.empty() ? name : make_clark_name(namespace_uri, name);
|
||||
if(std::find(resolutionStack_.begin(), resolutionStack_.end(), clarkName) != resolutionStack_.end())
|
||||
throw std::runtime_error("Circular dependency: " + string_adaptor::asStdString(clarkName) + " refers to itself directly or indirectly.");
|
||||
|
||||
|
@ -178,6 +178,16 @@ public:
|
|||
} // resolveVariable
|
||||
|
||||
private:
|
||||
string_type make_clark_name(const string_type& namespace_uri, const string_type& name) const
|
||||
{
|
||||
string_type cn;
|
||||
string_adaptor::append(cn, string_adaptor::construct_from_utf8("{"));
|
||||
string_adaptor::append(cn, namespace_uri);
|
||||
string_adaptor::append(cn, string_adaptor::construct_from_utf8("}"));
|
||||
string_adaptor::append(cn, name);
|
||||
return cn;
|
||||
} // make_clark_name
|
||||
|
||||
XPathValue lookup(const Scope& scope, const string_type& name) const
|
||||
{
|
||||
typename Scope::const_iterator i = scope.find(name);
|
||||
|
|
98
tests/XSLT/main_wide.cpp
Normal file
98
tests/XSLT/main_wide.cpp
Normal file
|
@ -0,0 +1,98 @@
|
|||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4250)
|
||||
#endif
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <sstream>
|
||||
#include <map>
|
||||
|
||||
///////////////////////////////////////////////
|
||||
#include "../CppUnit/TestRunner.hpp"
|
||||
#include "../CppUnit/framework/Test.h"
|
||||
#include "../CppUnit/framework/TestCase.h"
|
||||
#include "../CppUnit/framework/TestSuite.h"
|
||||
|
||||
// #include "scope_test.hpp"
|
||||
#include "xslt_test.hpp"
|
||||
|
||||
std::set<std::string> parse_tests_to_run(int argc, const char* argv[]);
|
||||
void add_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names);
|
||||
void add_arabica_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names);
|
||||
|
||||
const char* xalan_tests[] = {"attribvaltemplate", "axes", "boolean", "conditional",
|
||||
"conflictres", "copy", "dflt", "expression", "extend",
|
||||
/*"idkey",*/ "impincl", "lre", "match", "math",
|
||||
"mdocs", "message", "modes", "namedtemplate",
|
||||
"namespace", "node", /*"numberformat",*/ /*"numbering",*/
|
||||
"output", "position", "predicate", "processorinfo", "reluri",
|
||||
"select", "sort", "string", "variable", "ver", "whitespace", 0};
|
||||
|
||||
const char* msft_tests[] = { "AVTs", /*"AttributeSets",*/ "Attributes", "BVTs",
|
||||
"Comment", "Completeness", "ConflictResolution", "Copying",
|
||||
"Elements", "Errors", "Fallback", "ForEach", /*"FormatNumber",*/
|
||||
"ForwardComp", "Import", "Keys", "Messages",
|
||||
"Miscellaneous", "Modes", "NamedTemplates", "Namespace",
|
||||
"Namespace-alias", "Namespace_XPath", /*"Number",*/
|
||||
/*"Output",*/ "ProcessingInstruction", "RTF", "Sorting",
|
||||
"Stylesheet", "Template", "Text", "Valueof",
|
||||
"Variables", "Whitespaces", "XSLTFunctions", 0 };
|
||||
|
||||
const char* arabica_tests[] = { "attributes",
|
||||
"errors", "include", "processing-instruction",
|
||||
"stylesheet", "text", "variables", 0 };
|
||||
|
||||
int main(int argc, const char* argv[])
|
||||
{
|
||||
TestRunner runner;
|
||||
std::set<std::string> tests_to_run = parse_tests_to_run(argc, argv);
|
||||
|
||||
// runner.addTest("ScopeTest", ScopeTest_suite<string_type, string_adaptor>());
|
||||
|
||||
Loader loader;
|
||||
|
||||
add_tests(runner, loader, tests_to_run, xalan_tests);
|
||||
add_tests(runner, loader, tests_to_run, msft_tests);
|
||||
add_arabica_tests(runner, loader, tests_to_run, arabica_tests);
|
||||
|
||||
runner.run(argc, argv);
|
||||
|
||||
return 77;
|
||||
} // main
|
||||
|
||||
std::set<std::string> parse_tests_to_run(int argc, const char* argv[])
|
||||
{
|
||||
std::set<std::string> tests;
|
||||
for(int a = 1; a != argc; ++a)
|
||||
if(argv[a][0] != '-')
|
||||
tests.insert(argv[a]);
|
||||
else
|
||||
{
|
||||
if(std::string(argv[a]) == "-log")
|
||||
++a; // skip next
|
||||
} // if ...
|
||||
|
||||
return tests;
|
||||
} // tests_to_run
|
||||
|
||||
void add_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names)
|
||||
{
|
||||
std::set<std::string>::const_iterator end = wanted.end();
|
||||
while(*test_names != 0)
|
||||
{
|
||||
if(wanted.empty() || (wanted.find(*test_names) != end))
|
||||
runner.addTest(*test_names, loader.XSLTTest_suite(*test_names));
|
||||
++test_names;
|
||||
} // while ...
|
||||
} // all_all_tests
|
||||
|
||||
void add_arabica_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names)
|
||||
{
|
||||
std::set<std::string>::const_iterator end = wanted.end();
|
||||
while(*test_names != 0)
|
||||
{
|
||||
if(wanted.empty() || (wanted.find(*test_names) != end))
|
||||
runner.addTest(*test_names, loader.ArabicaTest_suite(*test_names));
|
||||
++test_names;
|
||||
} // while ...
|
||||
} // all_all_tests
|
145
vs2012/test_xslt_wide.vcxproj
Normal file
145
vs2012/test_xslt_wide.vcxproj
Normal file
|
@ -0,0 +1,145 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{44BA3424-C58E-4A49-ADDD-6180C61E5E34}</ProjectGuid>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v110</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC71.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\..\bin\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug_test_xslt\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\..\bin\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release_test_xslt\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">xslt_test</TargetName>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">xslt_test</TargetName>
|
||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\work\usr\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\work\usr\lib;$(LibraryPath)</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/Zm1000 %(AdditionalOptions)</AdditionalOptions>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>..\lib\arabica-debug.lib;..\lib\cppunit-debug.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>$(OutDir)$(TargetName).pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>NotSet</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>/Zm1000 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<DisableLanguageExtensions>false</DisableLanguageExtensions>
|
||||
<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
|
||||
<ForceConformanceInForLoopScope>true</ForceConformanceInForLoopScope>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>..\lib\arabica.lib;..\lib\cppunit.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName).exe</OutputFile>
|
||||
<GenerateDebugInformation>false</GenerateDebugInformation>
|
||||
<SubSystem>Console</SubSystem>
|
||||
<OptimizeReferences>
|
||||
</OptimizeReferences>
|
||||
<EnableCOMDATFolding>
|
||||
</EnableCOMDATFolding>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<DataExecutionPrevention>
|
||||
</DataExecutionPrevention>
|
||||
<TargetMachine>NotSet</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="..\tests\Xslt\main_wide.cpp" />
|
||||
<ClCompile Include="..\tests\XSLT\xslt_test.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\tests\Xslt\xslt_test.hpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="..\tests\XSLT\testsuite\TESTS\arabica-catalog.xml" />
|
||||
<None Include="..\tests\Xslt\testsuite\Tests\arabica-expected-fails.xml" />
|
||||
<None Include="..\tests\Xslt\testsuite\Tests\catalog.xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="lib_arabica.vcxproj">
|
||||
<Project>{4ca72415-d03a-4447-be4e-c093a5146cac}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="test_DOM.vcxproj">
|
||||
<Project>{74a66132-475a-4da1-8ef7-9cb0ef71e3d8}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="test_xpath.vcxproj">
|
||||
<Project>{b3c75b3a-bb0a-4b23-87f9-fb9cd98ff8ce}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
Loading…
Reference in a new issue