Bartosz Dziewoński has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/280691

Change subject: testsuitegenerator (and friends): Adjust for the traity world
......................................................................

testsuitegenerator (and friends): Adjust for the traity world

I think that's it? We should check that the same number of test cases
are generated before and after.

Goes with Ic6604011fc491df01793478577b7edb6e782f488.

Bug: T74892
Change-Id: Ia55831e671a4544252f59943bc06e4ea4f6dc766
---
M bin/doccomparer.rb
M bin/docparser.rb
M bin/testsuitegenerator.rb
3 files changed, 6 insertions(+), 6 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/oojs/ui refs/changes/91/280691/1

diff --git a/bin/doccomparer.rb b/bin/doccomparer.rb
index 3a7cd31..7772548 100644
--- a/bin/doccomparer.rb
+++ b/bin/doccomparer.rb
@@ -50,7 +50,6 @@
                val = val.dup
                val[:mixins].delete 'OO.EventEmitter' # JS only
                val[:mixins].delete 'PendingElement' # JS only
-               val.delete :parent if val[:parent] == 'ElementMixin' # PHP only
                val.delete :methods
                val.delete :properties
                val.delete :events
diff --git a/bin/docparser.rb b/bin/docparser.rb
index dfd907d..e60cf5a 100644
--- a/bin/docparser.rb
+++ b/bin/docparser.rb
@@ -58,7 +58,7 @@
                }
                valid_for_all = %w[name description].map(&:to_sym)
                valid_per_kind = {
-                       class:    valid_for_all + %w[parent mixins methods 
properties events abstract].map(&:to_sym),
+                       class:    valid_for_all + %w[parent mixins methods 
properties events abstract trait].map(&:to_sym),
                        method:   valid_for_all + %w[params config return 
visibility static].map(&:to_sym),
                        property: valid_for_all + %w[type static].map(&:to_sym),
                        event:    valid_for_all + %w[params].map(&:to_sym),
@@ -193,7 +193,7 @@
                                m = code_line.match(/
                                        \s*
                                        (?:(public|protected|private)\s)?
-                                       (?:(static)\s)?(function\s|class\s|\$)
+                                       
(?:(static)\s)?(function\s|class\s|trait\s|\$)
                                        (\w+)
                                        (?:\sextends\s(\w+))?
                                /x)
@@ -202,8 +202,9 @@
                                        next
                                end
                                visibility, static, kind_, name, parent = 
m.captures
-                               kind = {'$' => :property, 'function' => 
:method, 'class' => :class}[ kind_.strip ]
+                               kind = {'$' => :property, 'function' => 
:method, 'class' => :class, 'trait' => :class}[ kind_.strip ]
                                data[:visibility] = {'private' => :private, 
'protected' => :protected, 'public' => :public}[ visibility ] || :public
+                               data[:trait] = true if kind_.strip == 'trait'
                                data[:static] = true if static
                                data[:parent] = cleanup_class_name(parent) if 
parent
                                data[:name] ||= cleanup_class_name(name)
@@ -240,7 +241,7 @@
        # this is evil, assumes we only have one class in a file, but we'd need 
a proper parser to do it better
        if current_class
                current_class[:mixins] +=
-                       text.scan(/\$this->mixin\( .*?new (\w+)\( 
\$this/).flatten.map(&method(:cleanup_class_name))
+                       text.scan(/\buse 
(\w+);/).flatten.map(&method(:cleanup_class_name))
        end
 
        output << current_class if current_class
diff --git a/bin/testsuitegenerator.rb b/bin/testsuitegenerator.rb
index 9091052..7cdcd68 100644
--- a/bin/testsuitegenerator.rb
+++ b/bin/testsuitegenerator.rb
@@ -17,7 +17,7 @@
        untestable_classes = %w[DropdownInputWidget ComboBoxInputWidget 
RadioSelectInputWidget]
        testable_classes = classes
                .reject{|c| c[:abstract] } # can't test abstract classes
-               .reject{|c| !c[:parent] || c[:parent] == 'ElementMixin' || 
c[:parent] == 'Theme' } # can't test abstract
+               .reject{|c| !c[:parent] || c[:trait] || c[:parent] == 'Theme' } 
# can't test abstract
                .reject{|c| %w[Element Widget Layout Theme].include? c[:name] } 
# no toplevel
                .reject{|c| untestable_classes.include? c[:name] } # different 
PHP and JS implementations
 

-- 
To view, visit https://gerrit.wikimedia.org/r/280691
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia55831e671a4544252f59943bc06e4ea4f6dc766
Gerrit-PatchSet: 1
Gerrit-Project: oojs/ui
Gerrit-Branch: master
Gerrit-Owner: Bartosz Dziewoński <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to