Permalink
Browse files

Merge pull request #197 from dahlia/annotation-arg-value-unicode

Make annotation argument values able to contain Unicode characters
  • Loading branch information...
kanghyojun committed Nov 27, 2017
2 parents 74817f3 + 28e227c commit 69de22517ba57f6ced555622b2afc444fb88d31c
Showing with 6 additions and 4 deletions.
  1. +1 −1 src/Nirum/Targets/Python.hs
  2. +1 −0 test/nirum_fixture/fixture/foo.nrm
  3. +4 −3 test/python/annotation_test.py
@@ -1105,7 +1105,7 @@ class {className}_Client($className):
escapeSingle = T.strip . T.replace "'" "\\'"
toKeyStr :: I.Identifier -> T.Text -> T.Text
toKeyStr k v =
[qq|'{toAttributeName k}': '''{escapeSingle v}'''|]
[qq|'{toAttributeName k}': u'''{escapeSingle v}'''|]
compileMethodAnnotation :: Method -> T.Text
compileMethodAnnotation Method { methodName = mName
, methodAnnotations = annoSet
@@ -91,6 +91,7 @@ service ping-service (
@http-resource(method="GET", path="/ping")
@quote(single="'", triple="'''")
@unicode(unicode="유니코드")
bool ping (
# Method docs.
text nonce,
@@ -8,8 +8,9 @@ def test_annotation_as_error():
def test_service_method_annotation_metadata():
expect = Map({
'docs': Map({'docs': 'Method docs.'}),
'http_resource': Map({'method': 'GET', 'path': '/ping'}),
'quote': Map({'single': "'", 'triple': "'''"})
'docs': Map({'docs': u'Method docs.'}),
'http_resource': Map({'method': u'GET', 'path': u'/ping'}),
'quote': Map({'single': u"'", 'triple': u"'''"}),
'unicode': Map({'unicode': u'\uc720\ub2c8\ucf54\ub4dc'}),
})
assert PingService.__nirum_method_annotations__['ping'] == expect

0 comments on commit 69de225

Please sign in to comment.