Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(688)

Unified Diff: grit/node/misc_unittest.py

Issue 11155024: If-then-else support for GRIT (Closed) Base URL: https://grit-i18n.googlecode.com/svn/trunk
Patch Set: comments Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « grit/node/misc.py ('k') | grit/test_suite_all.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: grit/node/misc_unittest.py
diff --git a/grit/node/misc_unittest.py b/grit/node/misc_unittest.py
index 677b02e526fed8c7d1a30c23041c35d700ed1f50..578a1e28614917bc19cc2889cac03aab37b4faa2 100644
--- a/grit/node/misc_unittest.py
+++ b/grit/node/misc_unittest.py
@@ -101,6 +101,46 @@ class IfNodeUnittest(unittest.TestCase):
self.failUnless(hello_message not in active)
self.failUnless(french_message in active)
+ def testElsiness(self):
+ grd = util.ParseGrdForUnittest('''
+ <messages>
+ <if expr="True">
+ <then> <message name="IDS_YES1"></message> </then>
+ <else> <message name="IDS_NO1"></message> </else>
+ </if>
+ <if expr="True">
+ <then> <message name="IDS_YES2"></message> </then>
+ <else> </else>
+ </if>
+ <if expr="True">
+ <then> </then>
+ <else> <message name="IDS_NO2"></message> </else>
+ </if>
+ <if expr="True">
+ <then> </then>
+ <else> </else>
+ </if>
+ <if expr="False">
+ <then> <message name="IDS_NO3"></message> </then>
+ <else> <message name="IDS_YES3"></message> </else>
+ </if>
+ <if expr="False">
+ <then> <message name="IDS_NO4"></message> </then>
+ <else> </else>
+ </if>
+ <if expr="False">
+ <then> </then>
+ <else> <message name="IDS_YES4"></message> </else>
+ </if>
+ <if expr="False">
+ <then> </then>
+ <else> </else>
+ </if>
+ </messages>''')
+ included = [msg.attrs['name'] for msg in grd.ActiveDescendants()
+ if msg.name == 'message']
+ self.assertEqual(['IDS_YES1', 'IDS_YES2', 'IDS_YES3', 'IDS_YES4'], included)
+
def testIffynessWithOutputNodes(self):
grd = grd_reader.Parse(StringIO.StringIO('''
<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
@@ -165,8 +205,6 @@ class IfNodeUnittest(unittest.TestCase):
outputs = [output.GetFilename() for output in grd.GetOutputFiles()]
self.assertNotEquals(outputs, ['uncond1.rc', 'uncond2.adm', 'iftest.h'])
-
-class IfNodeChildrenUnittest(unittest.TestCase):
def testChildrenAccepted(self):
grd = grd_reader.Parse(StringIO.StringIO('''<?xml version="1.0"?>
<grit latest_public_release="2" source_lang_id="en-US" current_release="3" base_dir=".">
« no previous file with comments | « grit/node/misc.py ('k') | grit/test_suite_all.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698