From a7744b7a5c5c81779696a12560ec25373c6c8f12 Mon Sep 17 00:00:00 2001 From: Yorick Peterse Date: Wed, 8 Jul 2015 01:10:37 +0200 Subject: [PATCH] Use the XPath compiler for XPath/CSS specs --- .../css/{evaluator => compiler}/axes_spec.rb | 0 .../{evaluator => compiler}/classes_spec.rb | 0 .../css/{evaluator => compiler}/ids_spec.rb | 0 .../{evaluator => compiler}/operators_spec.rb | 0 .../css/{evaluator => compiler}/paths_spec.rb | 0 .../predicates_spec.rb | 0 .../pseudo_classes/empty_spec.rb | 0 .../pseudo_classes/first_child_spec.rb | 0 .../pseudo_classes/first_of_type_spec.rb | 0 .../pseudo_classes/last_child_spec.rb | 0 .../pseudo_classes/last_of_type_spec.rb | 0 .../pseudo_classes/nth_child_spec.rb | 0 .../pseudo_classes/nth_last_child_spec.rb | 0 .../pseudo_classes/nth_last_of_type_spec.rb | 0 .../pseudo_classes/nth_of_type_spec.rb | 0 .../pseudo_classes/nth_spec.rb | 0 .../pseudo_classes/only_child_spec.rb | 0 .../pseudo_classes/only_of_type_spec.rb | 0 .../pseudo_classes/root_spec.rb | 0 .../axes/ancestor_or_self_spec.rb | 2 +- .../axes/ancestor_spec.rb | 2 +- .../axes/attribute_spec.rb | 2 +- .../axes/child_spec.rb | 2 +- .../axes/descendant_or_self_spec.rb | 2 +- .../axes/descendant_spec.rb | 2 +- .../axes/following_sibling_spec.rb | 2 +- .../axes/following_spec.rb | 2 +- .../axes/namespace_spec.rb | 2 +- .../axes/parent_spec.rb | 2 +- .../axes/preceding_sibling_spec.rb | 2 +- .../axes/preceding_spec.rb | 2 +- .../{evaluator => compiler}/axes/self_spec.rb | 2 +- .../calls/boolean_spec.rb | 2 +- .../calls/ceiling_spec.rb | 2 +- .../calls/concat_spec.rb | 2 +- .../calls/contains_spec.rb | 2 +- .../calls/count_spec.rb | 2 +- .../calls/false_spec.rb | 2 +- .../calls/floor_spec.rb | 2 +- .../{evaluator => compiler}/calls/id_spec.rb | 2 +- .../calls/lang_spec.rb | 2 +- .../calls/last_spec.rb | 2 +- .../calls/local_name_spec.rb | 2 +- .../calls/name_spec.rb | 2 +- .../calls/namespace_uri_spec.rb | 2 +- .../calls/normalize_space_spec.rb | 2 +- .../{evaluator => compiler}/calls/not_spec.rb | 2 +- .../calls/number_spec.rb | 2 +- .../calls/position_spec.rb | 2 +- .../calls/round_spec.rb | 2 +- .../calls/starts_with_spec.rb | 2 +- .../calls/string_length_spec.rb | 2 +- .../calls/string_spec.rb | 2 +- .../calls/substring_after_spec.rb | 2 +- .../calls/substring_before_spec.rb | 2 +- .../calls/substring_spec.rb | 2 +- .../{evaluator => compiler}/calls/sum_spec.rb | 2 +- .../calls/translate_spec.rb | 2 +- .../calls/true_spec.rb | 2 +- .../{evaluator => compiler}/html_spec.rb | 2 +- .../operators/add_spec.rb | 2 +- .../operators/and_spec.rb | 2 +- .../operators/div_spec.rb | 2 +- .../operators/eq_spec.rb | 2 +- .../operators/gt_spec.rb | 2 +- .../operators/gte_spec.rb | 2 +- .../operators/lt_spec.rb | 2 +- .../operators/lte_spec.rb | 2 +- .../operators/mod_spec.rb | 2 +- .../operators/mul_spec.rb | 2 +- .../operators/neq_spec.rb | 2 +- .../operators/or_spec.rb | 2 +- .../operators/pipe_spec.rb | 2 +- .../operators/sub_spec.rb | 2 +- .../{evaluator => compiler}/paths_spec.rb | 2 +- .../predicates_spec.rb | 2 +- .../type_tests/comment_spec.rb | 2 +- .../type_tests/node_spec.rb | 2 +- .../type_tests/processing_instruction_spec.rb | 2 +- .../type_tests/text_spec.rb | 2 +- .../types/float_spec.rb | 2 +- .../{evaluator => compiler}/types/int_spec.rb | 2 +- .../types/string_spec.rb | 2 +- .../{evaluator => compiler}/variables_spec.rb | 2 +- .../{evaluator => compiler}/wildcard_spec.rb | 2 +- spec/oga/xpath/evaluator/general_spec.rb | 208 ------------------ spec/support/evaluation_helpers.rb | 12 +- 87 files changed, 75 insertions(+), 277 deletions(-) rename spec/oga/css/{evaluator => compiler}/axes_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/classes_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/ids_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/operators_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/paths_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/predicates_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/empty_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/first_child_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/first_of_type_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/last_child_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/last_of_type_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/nth_child_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/nth_last_child_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/nth_last_of_type_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/nth_of_type_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/nth_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/only_child_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/only_of_type_spec.rb (100%) rename spec/oga/css/{evaluator => compiler}/pseudo_classes/root_spec.rb (100%) rename spec/oga/xpath/{evaluator => compiler}/axes/ancestor_or_self_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/axes/ancestor_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/axes/attribute_spec.rb (94%) rename spec/oga/xpath/{evaluator => compiler}/axes/child_spec.rb (94%) rename spec/oga/xpath/{evaluator => compiler}/axes/descendant_or_self_spec.rb (98%) rename spec/oga/xpath/{evaluator => compiler}/axes/descendant_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/axes/following_sibling_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/axes/following_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/axes/namespace_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/axes/parent_spec.rb (94%) rename spec/oga/xpath/{evaluator => compiler}/axes/preceding_sibling_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/axes/preceding_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/axes/self_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/calls/boolean_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/calls/ceiling_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/calls/concat_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/calls/contains_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/calls/count_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/calls/false_spec.rb (86%) rename spec/oga/xpath/{evaluator => compiler}/calls/floor_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/calls/id_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/calls/lang_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/calls/last_spec.rb (90%) rename spec/oga/xpath/{evaluator => compiler}/calls/local_name_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/calls/name_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/calls/namespace_uri_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/calls/normalize_space_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/calls/not_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/calls/number_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/calls/position_spec.rb (94%) rename spec/oga/xpath/{evaluator => compiler}/calls/round_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/calls/starts_with_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/calls/string_length_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/calls/string_spec.rb (98%) rename spec/oga/xpath/{evaluator => compiler}/calls/substring_after_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/calls/substring_before_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/calls/substring_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/calls/sum_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/calls/translate_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/calls/true_spec.rb (85%) rename spec/oga/xpath/{evaluator => compiler}/html_spec.rb (91%) rename spec/oga/xpath/{evaluator => compiler}/operators/add_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/operators/and_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/operators/div_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/operators/eq_spec.rb (98%) rename spec/oga/xpath/{evaluator => compiler}/operators/gt_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/operators/gte_spec.rb (98%) rename spec/oga/xpath/{evaluator => compiler}/operators/lt_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/operators/lte_spec.rb (98%) rename spec/oga/xpath/{evaluator => compiler}/operators/mod_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/operators/mul_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/operators/neq_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/operators/or_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/operators/pipe_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/operators/sub_spec.rb (96%) rename spec/oga/xpath/{evaluator => compiler}/paths_spec.rb (97%) rename spec/oga/xpath/{evaluator => compiler}/predicates_spec.rb (93%) rename spec/oga/xpath/{evaluator => compiler}/type_tests/comment_spec.rb (94%) rename spec/oga/xpath/{evaluator => compiler}/type_tests/node_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/type_tests/processing_instruction_spec.rb (95%) rename spec/oga/xpath/{evaluator => compiler}/type_tests/text_spec.rb (93%) rename spec/oga/xpath/{evaluator => compiler}/types/float_spec.rb (92%) rename spec/oga/xpath/{evaluator => compiler}/types/int_spec.rb (92%) rename spec/oga/xpath/{evaluator => compiler}/types/string_spec.rb (86%) rename spec/oga/xpath/{evaluator => compiler}/variables_spec.rb (94%) rename spec/oga/xpath/{evaluator => compiler}/wildcard_spec.rb (96%) delete mode 100644 spec/oga/xpath/evaluator/general_spec.rb diff --git a/spec/oga/css/evaluator/axes_spec.rb b/spec/oga/css/compiler/axes_spec.rb similarity index 100% rename from spec/oga/css/evaluator/axes_spec.rb rename to spec/oga/css/compiler/axes_spec.rb diff --git a/spec/oga/css/evaluator/classes_spec.rb b/spec/oga/css/compiler/classes_spec.rb similarity index 100% rename from spec/oga/css/evaluator/classes_spec.rb rename to spec/oga/css/compiler/classes_spec.rb diff --git a/spec/oga/css/evaluator/ids_spec.rb b/spec/oga/css/compiler/ids_spec.rb similarity index 100% rename from spec/oga/css/evaluator/ids_spec.rb rename to spec/oga/css/compiler/ids_spec.rb diff --git a/spec/oga/css/evaluator/operators_spec.rb b/spec/oga/css/compiler/operators_spec.rb similarity index 100% rename from spec/oga/css/evaluator/operators_spec.rb rename to spec/oga/css/compiler/operators_spec.rb diff --git a/spec/oga/css/evaluator/paths_spec.rb b/spec/oga/css/compiler/paths_spec.rb similarity index 100% rename from spec/oga/css/evaluator/paths_spec.rb rename to spec/oga/css/compiler/paths_spec.rb diff --git a/spec/oga/css/evaluator/predicates_spec.rb b/spec/oga/css/compiler/predicates_spec.rb similarity index 100% rename from spec/oga/css/evaluator/predicates_spec.rb rename to spec/oga/css/compiler/predicates_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/empty_spec.rb b/spec/oga/css/compiler/pseudo_classes/empty_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/empty_spec.rb rename to spec/oga/css/compiler/pseudo_classes/empty_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/first_child_spec.rb b/spec/oga/css/compiler/pseudo_classes/first_child_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/first_child_spec.rb rename to spec/oga/css/compiler/pseudo_classes/first_child_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/first_of_type_spec.rb b/spec/oga/css/compiler/pseudo_classes/first_of_type_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/first_of_type_spec.rb rename to spec/oga/css/compiler/pseudo_classes/first_of_type_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/last_child_spec.rb b/spec/oga/css/compiler/pseudo_classes/last_child_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/last_child_spec.rb rename to spec/oga/css/compiler/pseudo_classes/last_child_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/last_of_type_spec.rb b/spec/oga/css/compiler/pseudo_classes/last_of_type_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/last_of_type_spec.rb rename to spec/oga/css/compiler/pseudo_classes/last_of_type_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/nth_child_spec.rb b/spec/oga/css/compiler/pseudo_classes/nth_child_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/nth_child_spec.rb rename to spec/oga/css/compiler/pseudo_classes/nth_child_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/nth_last_child_spec.rb b/spec/oga/css/compiler/pseudo_classes/nth_last_child_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/nth_last_child_spec.rb rename to spec/oga/css/compiler/pseudo_classes/nth_last_child_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/nth_last_of_type_spec.rb b/spec/oga/css/compiler/pseudo_classes/nth_last_of_type_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/nth_last_of_type_spec.rb rename to spec/oga/css/compiler/pseudo_classes/nth_last_of_type_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/nth_of_type_spec.rb b/spec/oga/css/compiler/pseudo_classes/nth_of_type_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/nth_of_type_spec.rb rename to spec/oga/css/compiler/pseudo_classes/nth_of_type_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/nth_spec.rb b/spec/oga/css/compiler/pseudo_classes/nth_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/nth_spec.rb rename to spec/oga/css/compiler/pseudo_classes/nth_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/only_child_spec.rb b/spec/oga/css/compiler/pseudo_classes/only_child_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/only_child_spec.rb rename to spec/oga/css/compiler/pseudo_classes/only_child_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/only_of_type_spec.rb b/spec/oga/css/compiler/pseudo_classes/only_of_type_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/only_of_type_spec.rb rename to spec/oga/css/compiler/pseudo_classes/only_of_type_spec.rb diff --git a/spec/oga/css/evaluator/pseudo_classes/root_spec.rb b/spec/oga/css/compiler/pseudo_classes/root_spec.rb similarity index 100% rename from spec/oga/css/evaluator/pseudo_classes/root_spec.rb rename to spec/oga/css/compiler/pseudo_classes/root_spec.rb diff --git a/spec/oga/xpath/evaluator/axes/ancestor_or_self_spec.rb b/spec/oga/xpath/compiler/axes/ancestor_or_self_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/axes/ancestor_or_self_spec.rb rename to spec/oga/xpath/compiler/axes/ancestor_or_self_spec.rb index dcc397b..58e0b08 100644 --- a/spec/oga/xpath/evaluator/axes/ancestor_or_self_spec.rb +++ b/spec/oga/xpath/compiler/axes/ancestor_or_self_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'ancestor-or-self axis' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/axes/ancestor_spec.rb b/spec/oga/xpath/compiler/axes/ancestor_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/axes/ancestor_spec.rb rename to spec/oga/xpath/compiler/axes/ancestor_spec.rb index 53aa369..bcffee7 100644 --- a/spec/oga/xpath/evaluator/axes/ancestor_spec.rb +++ b/spec/oga/xpath/compiler/axes/ancestor_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'ancestor axis' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/axes/attribute_spec.rb b/spec/oga/xpath/compiler/axes/attribute_spec.rb similarity index 94% rename from spec/oga/xpath/evaluator/axes/attribute_spec.rb rename to spec/oga/xpath/compiler/axes/attribute_spec.rb index 1ed1498..adbeebc 100644 --- a/spec/oga/xpath/evaluator/axes/attribute_spec.rb +++ b/spec/oga/xpath/compiler/axes/attribute_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'attribute axis' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/axes/child_spec.rb b/spec/oga/xpath/compiler/axes/child_spec.rb similarity index 94% rename from spec/oga/xpath/evaluator/axes/child_spec.rb rename to spec/oga/xpath/compiler/axes/child_spec.rb index 55b51bc..d4526ac 100644 --- a/spec/oga/xpath/evaluator/axes/child_spec.rb +++ b/spec/oga/xpath/compiler/axes/child_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'child axis' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb b/spec/oga/xpath/compiler/axes/descendant_or_self_spec.rb similarity index 98% rename from spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb rename to spec/oga/xpath/compiler/axes/descendant_or_self_spec.rb index fd89f70..ed6dc01 100644 --- a/spec/oga/xpath/evaluator/axes/descendant_or_self_spec.rb +++ b/spec/oga/xpath/compiler/axes/descendant_or_self_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'descendant-or-self axis' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/axes/descendant_spec.rb b/spec/oga/xpath/compiler/axes/descendant_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/axes/descendant_spec.rb rename to spec/oga/xpath/compiler/axes/descendant_spec.rb index ec161f0..ff0196d 100644 --- a/spec/oga/xpath/evaluator/axes/descendant_spec.rb +++ b/spec/oga/xpath/compiler/axes/descendant_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'descendant axis' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/axes/following_sibling_spec.rb b/spec/oga/xpath/compiler/axes/following_sibling_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/axes/following_sibling_spec.rb rename to spec/oga/xpath/compiler/axes/following_sibling_spec.rb index 38e161a..15b9e76 100644 --- a/spec/oga/xpath/evaluator/axes/following_sibling_spec.rb +++ b/spec/oga/xpath/compiler/axes/following_sibling_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'following-sibling axis' do before do # Strip whitespace so it's easier to retrieve/compare elements. diff --git a/spec/oga/xpath/evaluator/axes/following_spec.rb b/spec/oga/xpath/compiler/axes/following_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/axes/following_spec.rb rename to spec/oga/xpath/compiler/axes/following_spec.rb index 04701a9..a5616a6 100644 --- a/spec/oga/xpath/evaluator/axes/following_spec.rb +++ b/spec/oga/xpath/compiler/axes/following_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'following axis' do before do # Strip whitespace so it's easier to retrieve/compare elements. diff --git a/spec/oga/xpath/evaluator/axes/namespace_spec.rb b/spec/oga/xpath/compiler/axes/namespace_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/axes/namespace_spec.rb rename to spec/oga/xpath/compiler/axes/namespace_spec.rb index da19178..2adce10 100644 --- a/spec/oga/xpath/evaluator/axes/namespace_spec.rb +++ b/spec/oga/xpath/compiler/axes/namespace_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'namespace axis' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/axes/parent_spec.rb b/spec/oga/xpath/compiler/axes/parent_spec.rb similarity index 94% rename from spec/oga/xpath/evaluator/axes/parent_spec.rb rename to spec/oga/xpath/compiler/axes/parent_spec.rb index e189dcc..559a834 100644 --- a/spec/oga/xpath/evaluator/axes/parent_spec.rb +++ b/spec/oga/xpath/compiler/axes/parent_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'parent axis' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb b/spec/oga/xpath/compiler/axes/preceding_sibling_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb rename to spec/oga/xpath/compiler/axes/preceding_sibling_spec.rb index 653a8fd..7bc8cc0 100644 --- a/spec/oga/xpath/evaluator/axes/preceding_sibling_spec.rb +++ b/spec/oga/xpath/compiler/axes/preceding_sibling_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'preceding-sibling axis' do before do @document = parse(<<-EOF.strip.gsub(/\s+/m, '')) diff --git a/spec/oga/xpath/evaluator/axes/preceding_spec.rb b/spec/oga/xpath/compiler/axes/preceding_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/axes/preceding_spec.rb rename to spec/oga/xpath/compiler/axes/preceding_spec.rb index b065afb..de1deb1 100644 --- a/spec/oga/xpath/evaluator/axes/preceding_spec.rb +++ b/spec/oga/xpath/compiler/axes/preceding_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'preceding axis' do before do @document = parse(<<-EOF.strip.gsub(/\s+/m, '')) diff --git a/spec/oga/xpath/evaluator/axes/self_spec.rb b/spec/oga/xpath/compiler/axes/self_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/axes/self_spec.rb rename to spec/oga/xpath/compiler/axes/self_spec.rb index 204b191..903c1a6 100644 --- a/spec/oga/xpath/evaluator/axes/self_spec.rb +++ b/spec/oga/xpath/compiler/axes/self_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'self axis' do before do @document = parse('foobartest') diff --git a/spec/oga/xpath/evaluator/calls/boolean_spec.rb b/spec/oga/xpath/compiler/calls/boolean_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/calls/boolean_spec.rb rename to spec/oga/xpath/compiler/calls/boolean_spec.rb index 0737368..5e5d8c2 100644 --- a/spec/oga/xpath/evaluator/calls/boolean_spec.rb +++ b/spec/oga/xpath/compiler/calls/boolean_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'boolean() function' do before do @document = parse('foo') diff --git a/spec/oga/xpath/evaluator/calls/ceiling_spec.rb b/spec/oga/xpath/compiler/calls/ceiling_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/calls/ceiling_spec.rb rename to spec/oga/xpath/compiler/calls/ceiling_spec.rb index 3eba365..15432f5 100644 --- a/spec/oga/xpath/evaluator/calls/ceiling_spec.rb +++ b/spec/oga/xpath/compiler/calls/ceiling_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'ceiling() function' do before do @document = parse('10.123') diff --git a/spec/oga/xpath/evaluator/calls/concat_spec.rb b/spec/oga/xpath/compiler/calls/concat_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/calls/concat_spec.rb rename to spec/oga/xpath/compiler/calls/concat_spec.rb index 0fc16e2..3a1222a 100644 --- a/spec/oga/xpath/evaluator/calls/concat_spec.rb +++ b/spec/oga/xpath/compiler/calls/concat_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'concat() function' do before do @document = parse('foobar') diff --git a/spec/oga/xpath/evaluator/calls/contains_spec.rb b/spec/oga/xpath/compiler/calls/contains_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/calls/contains_spec.rb rename to spec/oga/xpath/compiler/calls/contains_spec.rb index c29e135..4dd2eaa 100644 --- a/spec/oga/xpath/evaluator/calls/contains_spec.rb +++ b/spec/oga/xpath/compiler/calls/contains_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'contains() function' do before do @document = parse('foofoobar') diff --git a/spec/oga/xpath/evaluator/calls/count_spec.rb b/spec/oga/xpath/compiler/calls/count_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/calls/count_spec.rb rename to spec/oga/xpath/compiler/calls/count_spec.rb index 6c6e79c..e8d31f8 100644 --- a/spec/oga/xpath/evaluator/calls/count_spec.rb +++ b/spec/oga/xpath/compiler/calls/count_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'count() function' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/calls/false_spec.rb b/spec/oga/xpath/compiler/calls/false_spec.rb similarity index 86% rename from spec/oga/xpath/evaluator/calls/false_spec.rb rename to spec/oga/xpath/compiler/calls/false_spec.rb index 77d731d..72ef2e1 100644 --- a/spec/oga/xpath/evaluator/calls/false_spec.rb +++ b/spec/oga/xpath/compiler/calls/false_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'false() function' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/calls/floor_spec.rb b/spec/oga/xpath/compiler/calls/floor_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/calls/floor_spec.rb rename to spec/oga/xpath/compiler/calls/floor_spec.rb index 39666af..7ef4d26 100644 --- a/spec/oga/xpath/evaluator/calls/floor_spec.rb +++ b/spec/oga/xpath/compiler/calls/floor_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'floor() function' do before do @document = parse('10.123') diff --git a/spec/oga/xpath/evaluator/calls/id_spec.rb b/spec/oga/xpath/compiler/calls/id_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/calls/id_spec.rb rename to spec/oga/xpath/compiler/calls/id_spec.rb index 861a2dc..11d0459 100644 --- a/spec/oga/xpath/evaluator/calls/id_spec.rb +++ b/spec/oga/xpath/compiler/calls/id_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'id() function' do before do @document = parse('a1') diff --git a/spec/oga/xpath/evaluator/calls/lang_spec.rb b/spec/oga/xpath/compiler/calls/lang_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/calls/lang_spec.rb rename to spec/oga/xpath/compiler/calls/lang_spec.rb index a187cb4..a7ecc73 100644 --- a/spec/oga/xpath/evaluator/calls/lang_spec.rb +++ b/spec/oga/xpath/compiler/calls/lang_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'lang() function' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/calls/last_spec.rb b/spec/oga/xpath/compiler/calls/last_spec.rb similarity index 90% rename from spec/oga/xpath/evaluator/calls/last_spec.rb rename to spec/oga/xpath/compiler/calls/last_spec.rb index 2f43feb..099f023 100644 --- a/spec/oga/xpath/evaluator/calls/last_spec.rb +++ b/spec/oga/xpath/compiler/calls/last_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'last() function' do before do @document = parse('foobar') diff --git a/spec/oga/xpath/evaluator/calls/local_name_spec.rb b/spec/oga/xpath/compiler/calls/local_name_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/calls/local_name_spec.rb rename to spec/oga/xpath/compiler/calls/local_name_spec.rb index 9c9f7dc..e822ec9 100644 --- a/spec/oga/xpath/evaluator/calls/local_name_spec.rb +++ b/spec/oga/xpath/compiler/calls/local_name_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'local-name() function' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/calls/name_spec.rb b/spec/oga/xpath/compiler/calls/name_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/calls/name_spec.rb rename to spec/oga/xpath/compiler/calls/name_spec.rb index d2c13c1..579c6d6 100644 --- a/spec/oga/xpath/evaluator/calls/name_spec.rb +++ b/spec/oga/xpath/compiler/calls/name_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'name() function' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/calls/namespace_uri_spec.rb b/spec/oga/xpath/compiler/calls/namespace_uri_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/calls/namespace_uri_spec.rb rename to spec/oga/xpath/compiler/calls/namespace_uri_spec.rb index 2424dd4..9d679cb 100644 --- a/spec/oga/xpath/evaluator/calls/namespace_uri_spec.rb +++ b/spec/oga/xpath/compiler/calls/namespace_uri_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'namespace-uri() function' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/calls/normalize_space_spec.rb b/spec/oga/xpath/compiler/calls/normalize_space_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/calls/normalize_space_spec.rb rename to spec/oga/xpath/compiler/calls/normalize_space_spec.rb index ed8575b..c59d516 100644 --- a/spec/oga/xpath/evaluator/calls/normalize_space_spec.rb +++ b/spec/oga/xpath/compiler/calls/normalize_space_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'normalize-space() function' do before do @document = parse(' fo o ') diff --git a/spec/oga/xpath/evaluator/calls/not_spec.rb b/spec/oga/xpath/compiler/calls/not_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/calls/not_spec.rb rename to spec/oga/xpath/compiler/calls/not_spec.rb index 6b56e07..a391a4a 100644 --- a/spec/oga/xpath/evaluator/calls/not_spec.rb +++ b/spec/oga/xpath/compiler/calls/not_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'not() function' do before do @document = parse('foo') diff --git a/spec/oga/xpath/evaluator/calls/number_spec.rb b/spec/oga/xpath/compiler/calls/number_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/calls/number_spec.rb rename to spec/oga/xpath/compiler/calls/number_spec.rb index de5ec89..0d7bcf2 100644 --- a/spec/oga/xpath/evaluator/calls/number_spec.rb +++ b/spec/oga/xpath/compiler/calls/number_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'number() function' do before do @document = parse('1010.5') diff --git a/spec/oga/xpath/evaluator/calls/position_spec.rb b/spec/oga/xpath/compiler/calls/position_spec.rb similarity index 94% rename from spec/oga/xpath/evaluator/calls/position_spec.rb rename to spec/oga/xpath/compiler/calls/position_spec.rb index 0e4d6ba..efbcacb 100644 --- a/spec/oga/xpath/evaluator/calls/position_spec.rb +++ b/spec/oga/xpath/compiler/calls/position_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'position() function' do before do @document = parse('foobar') diff --git a/spec/oga/xpath/evaluator/calls/round_spec.rb b/spec/oga/xpath/compiler/calls/round_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/calls/round_spec.rb rename to spec/oga/xpath/compiler/calls/round_spec.rb index 3c1b45b..cea3555 100644 --- a/spec/oga/xpath/evaluator/calls/round_spec.rb +++ b/spec/oga/xpath/compiler/calls/round_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'round() function' do before do @document = parse('10.123') diff --git a/spec/oga/xpath/evaluator/calls/starts_with_spec.rb b/spec/oga/xpath/compiler/calls/starts_with_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/calls/starts_with_spec.rb rename to spec/oga/xpath/compiler/calls/starts_with_spec.rb index 40778a8..c2c6310 100644 --- a/spec/oga/xpath/evaluator/calls/starts_with_spec.rb +++ b/spec/oga/xpath/compiler/calls/starts_with_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'starts-with() function' do before do @document = parse('foofoobar') diff --git a/spec/oga/xpath/evaluator/calls/string_length_spec.rb b/spec/oga/xpath/compiler/calls/string_length_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/calls/string_length_spec.rb rename to spec/oga/xpath/compiler/calls/string_length_spec.rb index 0545fae..453e6f4 100644 --- a/spec/oga/xpath/evaluator/calls/string_length_spec.rb +++ b/spec/oga/xpath/compiler/calls/string_length_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'string-length() function' do before do @document = parse('x') diff --git a/spec/oga/xpath/evaluator/calls/string_spec.rb b/spec/oga/xpath/compiler/calls/string_spec.rb similarity index 98% rename from spec/oga/xpath/evaluator/calls/string_spec.rb rename to spec/oga/xpath/compiler/calls/string_spec.rb index 369bee6..e38cd16 100644 --- a/spec/oga/xpath/evaluator/calls/string_spec.rb +++ b/spec/oga/xpath/compiler/calls/string_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'string() function' do before do @document = parse(<<-EOF) diff --git a/spec/oga/xpath/evaluator/calls/substring_after_spec.rb b/spec/oga/xpath/compiler/calls/substring_after_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/calls/substring_after_spec.rb rename to spec/oga/xpath/compiler/calls/substring_after_spec.rb index a8b9530..1fdffb6 100644 --- a/spec/oga/xpath/evaluator/calls/substring_after_spec.rb +++ b/spec/oga/xpath/compiler/calls/substring_after_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'substring-after() function' do before do @document = parse('-a-b-c') diff --git a/spec/oga/xpath/evaluator/calls/substring_before_spec.rb b/spec/oga/xpath/compiler/calls/substring_before_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/calls/substring_before_spec.rb rename to spec/oga/xpath/compiler/calls/substring_before_spec.rb index 08021fa..58a43b3 100644 --- a/spec/oga/xpath/evaluator/calls/substring_before_spec.rb +++ b/spec/oga/xpath/compiler/calls/substring_before_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'substring-before() function' do before do @document = parse('-a-b-c') diff --git a/spec/oga/xpath/evaluator/calls/substring_spec.rb b/spec/oga/xpath/compiler/calls/substring_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/calls/substring_spec.rb rename to spec/oga/xpath/compiler/calls/substring_spec.rb index e465337..4f2ea62 100644 --- a/spec/oga/xpath/evaluator/calls/substring_spec.rb +++ b/spec/oga/xpath/compiler/calls/substring_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'substring() function' do before do @document = parse('foobar3') diff --git a/spec/oga/xpath/evaluator/calls/sum_spec.rb b/spec/oga/xpath/compiler/calls/sum_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/calls/sum_spec.rb rename to spec/oga/xpath/compiler/calls/sum_spec.rb index 47a3439..653facb 100644 --- a/spec/oga/xpath/evaluator/calls/sum_spec.rb +++ b/spec/oga/xpath/compiler/calls/sum_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'sum() spec' do before do @document = parse('12') diff --git a/spec/oga/xpath/evaluator/calls/translate_spec.rb b/spec/oga/xpath/compiler/calls/translate_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/calls/translate_spec.rb rename to spec/oga/xpath/compiler/calls/translate_spec.rb index 3ff6fee..e437118 100644 --- a/spec/oga/xpath/evaluator/calls/translate_spec.rb +++ b/spec/oga/xpath/compiler/calls/translate_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'translate() function' do before do @document = parse('barabcABC') diff --git a/spec/oga/xpath/evaluator/calls/true_spec.rb b/spec/oga/xpath/compiler/calls/true_spec.rb similarity index 85% rename from spec/oga/xpath/evaluator/calls/true_spec.rb rename to spec/oga/xpath/compiler/calls/true_spec.rb index b1e61b5..ea51a49 100644 --- a/spec/oga/xpath/evaluator/calls/true_spec.rb +++ b/spec/oga/xpath/compiler/calls/true_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'true() function' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/html_spec.rb b/spec/oga/xpath/compiler/html_spec.rb similarity index 91% rename from spec/oga/xpath/evaluator/html_spec.rb rename to spec/oga/xpath/compiler/html_spec.rb index 0e9d145..de0cc14 100644 --- a/spec/oga/xpath/evaluator/html_spec.rb +++ b/spec/oga/xpath/compiler/html_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'querying HTML documents' do before do @document = parse_html('') diff --git a/spec/oga/xpath/evaluator/operators/add_spec.rb b/spec/oga/xpath/compiler/operators/add_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/operators/add_spec.rb rename to spec/oga/xpath/compiler/operators/add_spec.rb index ee5345a..cc3cf0f 100644 --- a/spec/oga/xpath/evaluator/operators/add_spec.rb +++ b/spec/oga/xpath/compiler/operators/add_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'add operator' do before do @document = parse('12') diff --git a/spec/oga/xpath/evaluator/operators/and_spec.rb b/spec/oga/xpath/compiler/operators/and_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/operators/and_spec.rb rename to spec/oga/xpath/compiler/operators/and_spec.rb index 7feeeac..3459c13 100644 --- a/spec/oga/xpath/evaluator/operators/and_spec.rb +++ b/spec/oga/xpath/compiler/operators/and_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'and operator' do before do @document = parse('11') diff --git a/spec/oga/xpath/evaluator/operators/div_spec.rb b/spec/oga/xpath/compiler/operators/div_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/operators/div_spec.rb rename to spec/oga/xpath/compiler/operators/div_spec.rb index 646aa9e..388d23b 100644 --- a/spec/oga/xpath/evaluator/operators/div_spec.rb +++ b/spec/oga/xpath/compiler/operators/div_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'div operator' do before do @document = parse('12') diff --git a/spec/oga/xpath/evaluator/operators/eq_spec.rb b/spec/oga/xpath/compiler/operators/eq_spec.rb similarity index 98% rename from spec/oga/xpath/evaluator/operators/eq_spec.rb rename to spec/oga/xpath/compiler/operators/eq_spec.rb index 059294b..63ce4d3 100644 --- a/spec/oga/xpath/evaluator/operators/eq_spec.rb +++ b/spec/oga/xpath/compiler/operators/eq_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'equal operator' do before do @document = parse('1010') diff --git a/spec/oga/xpath/evaluator/operators/gt_spec.rb b/spec/oga/xpath/compiler/operators/gt_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/operators/gt_spec.rb rename to spec/oga/xpath/compiler/operators/gt_spec.rb index 0bbd544..b575ad3 100644 --- a/spec/oga/xpath/evaluator/operators/gt_spec.rb +++ b/spec/oga/xpath/compiler/operators/gt_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'greater-than operator' do before do @document = parse('1020') diff --git a/spec/oga/xpath/evaluator/operators/gte_spec.rb b/spec/oga/xpath/compiler/operators/gte_spec.rb similarity index 98% rename from spec/oga/xpath/evaluator/operators/gte_spec.rb rename to spec/oga/xpath/compiler/operators/gte_spec.rb index 17e14b7..b9d20df 100644 --- a/spec/oga/xpath/evaluator/operators/gte_spec.rb +++ b/spec/oga/xpath/compiler/operators/gte_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'greater-than-or-equal operator' do before do @document = parse('1020') diff --git a/spec/oga/xpath/evaluator/operators/lt_spec.rb b/spec/oga/xpath/compiler/operators/lt_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/operators/lt_spec.rb rename to spec/oga/xpath/compiler/operators/lt_spec.rb index d3c7210..df71a22 100644 --- a/spec/oga/xpath/evaluator/operators/lt_spec.rb +++ b/spec/oga/xpath/compiler/operators/lt_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'lower-than operator' do before do @document = parse('1020') diff --git a/spec/oga/xpath/evaluator/operators/lte_spec.rb b/spec/oga/xpath/compiler/operators/lte_spec.rb similarity index 98% rename from spec/oga/xpath/evaluator/operators/lte_spec.rb rename to spec/oga/xpath/compiler/operators/lte_spec.rb index a7f8017..5075daa 100644 --- a/spec/oga/xpath/evaluator/operators/lte_spec.rb +++ b/spec/oga/xpath/compiler/operators/lte_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'lower-than-or-equal operator' do before do @document = parse('1020') diff --git a/spec/oga/xpath/evaluator/operators/mod_spec.rb b/spec/oga/xpath/compiler/operators/mod_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/operators/mod_spec.rb rename to spec/oga/xpath/compiler/operators/mod_spec.rb index 5c69959..37777ee 100644 --- a/spec/oga/xpath/evaluator/operators/mod_spec.rb +++ b/spec/oga/xpath/compiler/operators/mod_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'mod operator' do before do @document = parse('23') diff --git a/spec/oga/xpath/evaluator/operators/mul_spec.rb b/spec/oga/xpath/compiler/operators/mul_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/operators/mul_spec.rb rename to spec/oga/xpath/compiler/operators/mul_spec.rb index 4354a39..2e44a35 100644 --- a/spec/oga/xpath/evaluator/operators/mul_spec.rb +++ b/spec/oga/xpath/compiler/operators/mul_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'multiplication operator' do before do @document = parse('23') diff --git a/spec/oga/xpath/evaluator/operators/neq_spec.rb b/spec/oga/xpath/compiler/operators/neq_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/operators/neq_spec.rb rename to spec/oga/xpath/compiler/operators/neq_spec.rb index 07a6222..5f316c0 100644 --- a/spec/oga/xpath/evaluator/operators/neq_spec.rb +++ b/spec/oga/xpath/compiler/operators/neq_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'not-equal operator' do before do @document = parse('1010') diff --git a/spec/oga/xpath/evaluator/operators/or_spec.rb b/spec/oga/xpath/compiler/operators/or_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/operators/or_spec.rb rename to spec/oga/xpath/compiler/operators/or_spec.rb index 2c5d84c..6ec72df 100644 --- a/spec/oga/xpath/evaluator/operators/or_spec.rb +++ b/spec/oga/xpath/compiler/operators/or_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'or operator' do before do @document = parse('11') diff --git a/spec/oga/xpath/evaluator/operators/pipe_spec.rb b/spec/oga/xpath/compiler/operators/pipe_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/operators/pipe_spec.rb rename to spec/oga/xpath/compiler/operators/pipe_spec.rb index c221441..40bbb65 100644 --- a/spec/oga/xpath/evaluator/operators/pipe_spec.rb +++ b/spec/oga/xpath/compiler/operators/pipe_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'pipe operator' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/operators/sub_spec.rb b/spec/oga/xpath/compiler/operators/sub_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/operators/sub_spec.rb rename to spec/oga/xpath/compiler/operators/sub_spec.rb index ff80b38..4df3d46 100644 --- a/spec/oga/xpath/evaluator/operators/sub_spec.rb +++ b/spec/oga/xpath/compiler/operators/sub_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'subtraction operator' do before do @document = parse('23') diff --git a/spec/oga/xpath/evaluator/paths_spec.rb b/spec/oga/xpath/compiler/paths_spec.rb similarity index 97% rename from spec/oga/xpath/evaluator/paths_spec.rb rename to spec/oga/xpath/compiler/paths_spec.rb index 12191d2..2718bcb 100644 --- a/spec/oga/xpath/evaluator/paths_spec.rb +++ b/spec/oga/xpath/compiler/paths_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'paths' do before do @document = parse('Foo') diff --git a/spec/oga/xpath/evaluator/predicates_spec.rb b/spec/oga/xpath/compiler/predicates_spec.rb similarity index 93% rename from spec/oga/xpath/evaluator/predicates_spec.rb rename to spec/oga/xpath/compiler/predicates_spec.rb index 4d0cbab..0f35f12 100644 --- a/spec/oga/xpath/evaluator/predicates_spec.rb +++ b/spec/oga/xpath/compiler/predicates_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'predicates' do before do @document = parse(<<-EOF) diff --git a/spec/oga/xpath/evaluator/type_tests/comment_spec.rb b/spec/oga/xpath/compiler/type_tests/comment_spec.rb similarity index 94% rename from spec/oga/xpath/evaluator/type_tests/comment_spec.rb rename to spec/oga/xpath/compiler/type_tests/comment_spec.rb index 807f750..8a2ecf3 100644 --- a/spec/oga/xpath/evaluator/type_tests/comment_spec.rb +++ b/spec/oga/xpath/compiler/type_tests/comment_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'comment() tests' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/type_tests/node_spec.rb b/spec/oga/xpath/compiler/type_tests/node_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/type_tests/node_spec.rb rename to spec/oga/xpath/compiler/type_tests/node_spec.rb index 3a9f026..42a928a 100644 --- a/spec/oga/xpath/evaluator/type_tests/node_spec.rb +++ b/spec/oga/xpath/compiler/type_tests/node_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'node() tests' do before do @document = parse('foo') diff --git a/spec/oga/xpath/evaluator/type_tests/processing_instruction_spec.rb b/spec/oga/xpath/compiler/type_tests/processing_instruction_spec.rb similarity index 95% rename from spec/oga/xpath/evaluator/type_tests/processing_instruction_spec.rb rename to spec/oga/xpath/compiler/type_tests/processing_instruction_spec.rb index 4506bfe..8e5066f 100644 --- a/spec/oga/xpath/evaluator/type_tests/processing_instruction_spec.rb +++ b/spec/oga/xpath/compiler/type_tests/processing_instruction_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'processing-instruction() tests' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/type_tests/text_spec.rb b/spec/oga/xpath/compiler/type_tests/text_spec.rb similarity index 93% rename from spec/oga/xpath/evaluator/type_tests/text_spec.rb rename to spec/oga/xpath/compiler/type_tests/text_spec.rb index 2322c3c..401abbf 100644 --- a/spec/oga/xpath/evaluator/type_tests/text_spec.rb +++ b/spec/oga/xpath/compiler/type_tests/text_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'text() tests' do before do @document = parse('foobar') diff --git a/spec/oga/xpath/evaluator/types/float_spec.rb b/spec/oga/xpath/compiler/types/float_spec.rb similarity index 92% rename from spec/oga/xpath/evaluator/types/float_spec.rb rename to spec/oga/xpath/compiler/types/float_spec.rb index 5718ac4..cd0a0b6 100644 --- a/spec/oga/xpath/evaluator/types/float_spec.rb +++ b/spec/oga/xpath/compiler/types/float_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'float types' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/types/int_spec.rb b/spec/oga/xpath/compiler/types/int_spec.rb similarity index 92% rename from spec/oga/xpath/evaluator/types/int_spec.rb rename to spec/oga/xpath/compiler/types/int_spec.rb index 51b36a4..f03b7bb 100644 --- a/spec/oga/xpath/evaluator/types/int_spec.rb +++ b/spec/oga/xpath/compiler/types/int_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'integer types' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/types/string_spec.rb b/spec/oga/xpath/compiler/types/string_spec.rb similarity index 86% rename from spec/oga/xpath/evaluator/types/string_spec.rb rename to spec/oga/xpath/compiler/types/string_spec.rb index 4749185..d4ac449 100644 --- a/spec/oga/xpath/evaluator/types/string_spec.rb +++ b/spec/oga/xpath/compiler/types/string_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'string types' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/variables_spec.rb b/spec/oga/xpath/compiler/variables_spec.rb similarity index 94% rename from spec/oga/xpath/evaluator/variables_spec.rb rename to spec/oga/xpath/compiler/variables_spec.rb index 67825d2..0528ccf 100644 --- a/spec/oga/xpath/evaluator/variables_spec.rb +++ b/spec/oga/xpath/compiler/variables_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'variable bindings' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/wildcard_spec.rb b/spec/oga/xpath/compiler/wildcard_spec.rb similarity index 96% rename from spec/oga/xpath/evaluator/wildcard_spec.rb rename to spec/oga/xpath/compiler/wildcard_spec.rb index 2092679..bbb9b03 100644 --- a/spec/oga/xpath/evaluator/wildcard_spec.rb +++ b/spec/oga/xpath/compiler/wildcard_spec.rb @@ -1,6 +1,6 @@ require 'spec_helper' -describe Oga::XPath::Evaluator do +describe Oga::XPath::Compiler do describe 'wildcard paths' do before do @document = parse('') diff --git a/spec/oga/xpath/evaluator/general_spec.rb b/spec/oga/xpath/evaluator/general_spec.rb deleted file mode 100644 index 930cce2..0000000 --- a/spec/oga/xpath/evaluator/general_spec.rb +++ /dev/null @@ -1,208 +0,0 @@ -require 'spec_helper' - -describe Oga::XPath::Evaluator do - before do - @document = parse('Hello') - @evaluator = described_class.new(@document) - end - - describe '#function_node' do - before do - @document = parse('Hello') - @context_set = @document.children - end - - it 'returns the first node in the expression' do - exp = s(:axis, 'child', s(:test, nil, 'a')) - node = @evaluator.function_node(@context_set, exp) - - node.should == @context_set[0].children[0] - end - - it 'raises a TypeError if the expression did not return a node set' do - exp = s(:call, 'false') - block = lambda { @evaluator.function_node(@context_set, exp) } - - block.should raise_error(TypeError) - end - - it 'uses the current context node if the expression is empty' do - @evaluator.function_node(@context_set).should == @context_set[0] - end - end - - describe '#first_node_text' do - it 'returns the text of the first node' do - @evaluator.first_node_text(@document.children).should == 'Hello' - end - - it 'returns an empty string if the node set is empty' do - set = Oga::XML::NodeSet.new - - @evaluator.first_node_text(set).should == '' - end - end - - describe '#child_nodes' do - before do - @children = Oga::XML::NodeSet.new([ - Oga::XML::Element.new(:name => 'b'), - Oga::XML::Element.new(:name => 'b') - ]) - - @parent = Oga::XML::Element.new(:name => 'a', :children => @children) - end - - it "returns a node's child nodes" do - nodes = @evaluator.child_nodes([@parent]) - - nodes[0].should == @children[0] - nodes[1].should == @children[1] - end - end - - describe '#node_matches?' do - describe 'without a namespace' do - before do - @node = Oga::XML::Element.new(:name => 'a') - end - - it 'returns true if a node is matched by its name' do - @evaluator.node_matches?(@node, s(:test, nil, 'a')).should == true - end - - it 'returns true if a node is matched by a wildcard name' do - @evaluator.node_matches?(@node, s(:test, nil, '*')).should == true - end - - it 'returns false if a node is not matched by its name' do - @evaluator.node_matches?(@node, s(:test, nil, 'foo')).should == false - end - - it 'returns true if a node is matched without having a namespace' do - @evaluator.node_matches?(@node, s(:test, '*', 'a')).should == true - end - - it 'returns true if the node type matches' do - @evaluator.node_matches?(@node, s(:type_test, 'node')).should == true - end - - it 'returns false when trying to match an XML::Text instance' do - text = Oga::XML::Text.new(:text => 'Foobar') - - @evaluator.node_matches?(text, s(:test, nil, 'a')).should == false - end - - it 'returns true if a node is matched case insensitively' do - node = Oga::XML::Element.new(:name => 'DiV') - - @evaluator.node_matches?(node, s(:test, nil, 'div')).should == true - end - end - - describe 'with a custom namespace' do - before do - @node = Oga::XML::Element.new(:name => 'b', :namespace_name => 'x') - - @node.register_namespace('x', 'y') - end - - it 'returns true if a node is matched by its name and namespace' do - @evaluator.node_matches?(@node, s(:test, 'x', 'b')).should == true - end - - it 'returns false if a node is not matched by its namespace' do - @evaluator.node_matches?(@node, s(:test, 'y', 'b')).should == false - end - - it 'returns true if a node is matched by a wildcard namespace' do - @evaluator.node_matches?(@node, s(:test, '*', 'b')).should == true - end - - it 'returns true if a node is matched by a full wildcard search' do - @evaluator.node_matches?(@node, s(:test, '*', '*')).should == true - end - - it 'returns false when the node has a namespace that is not given' do - @evaluator.node_matches?(@node, s(:test, nil, 'b')).should == false - end - - it 'returns true if a node with a namespace is matched using a wildcard' do - @evaluator.node_matches?(@node, s(:test, nil, '*')).should == true - end - end - - describe 'using the default XML namespace' do - before do - @node = Oga::XML::Element.new(:name => 'a') - ns = Oga::XML::DEFAULT_NAMESPACE - - @node.register_namespace(ns.name, ns.uri) - end - - it 'returns true when the node name matches' do - @evaluator.node_matches?(@node, s(:test, nil, 'a')).should == true - end - - it 'returns true when the namespace prefix and node name match' do - @evaluator.node_matches?(@node, s(:test, 'xmlns', 'a')).should == true - end - - it 'returns false when the node name does not match' do - @evaluator.node_matches?(@node, s(:test, nil, 'b')).should == false - end - end - end - - describe '#type_matches?' do - before do - @element = Oga::XML::Element.new(:name => 'a') - @ns = Oga::XML::Namespace.new(:name => 'a') - end - - it 'returns true if the type matches' do - @evaluator.type_matches?(@element, s(:type_test, 'node')).should == true - end - - it 'returns false if the type does not match' do - @evaluator.type_matches?(@ns, s(:type_test, 'node')).should == false - end - end - - describe '#has_parent?' do - before do - @parent = Oga::XML::Element.new - @child = Oga::XML::Element.new - - set = Oga::XML::NodeSet.new([@child], @parent) - end - - it 'returns true if a node has a parent node' do - @evaluator.has_parent?(@child).should == true - end - - it 'returns false if a node has no parent node' do - @evaluator.has_parent?(@parent).should == false - end - end - - describe '#to_string' do - it 'converts a float to a string' do - @evaluator.to_string(10.5).should == '10.5' - end - - it 'converts a float without decimals to a string' do - @evaluator.to_string(10.0).should == '10' - end - end - - describe '#to_float' do - it 'converts a string to a float' do - @evaluator.to_float('10').should == 10.0 - end - - it "returns NaN for values that can't be converted to floats" do - @evaluator.to_float('a').should be_nan - end - end -end diff --git a/spec/support/evaluation_helpers.rb b/spec/support/evaluation_helpers.rb index 94bdd74..6e7f7a8 100644 --- a/spec/support/evaluation_helpers.rb +++ b/spec/support/evaluation_helpers.rb @@ -6,7 +6,11 @@ module Oga # @return [Oga::XML::NodeSet] # def evaluate_xpath(document, xpath) - return Oga::XPath::Evaluator.new(document).evaluate(xpath) + ast = parse_xpath(xpath) + compiler = Oga::XPath::Compiler.new + block = compiler.compile(ast) + + block.call(document) end ## @@ -17,9 +21,11 @@ module Oga # @return [Oga::XML::NodeSet] # def evaluate_css(document, css) - xpath = parse_css(css) + ast = parse_css(css) + compiler = Oga::XPath::Compiler.new + block = compiler.compile(ast) - return Oga::XPath::Evaluator.new(document).evaluate_ast(xpath) + block.call(document) end end # EvaluationHelpers end # Oga