コード例 #1
0
    def testSplitLongCommandExampleLineActuallyShort(self):
        example = """\
$ gcloud compute instances list --verbosity=info\
"""
        expected = example
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)
コード例 #2
0
    def testgSplitLongCommandExampleLineWithNestedQuotes(self):
        example = """\
$ gcloud beta logging write LOG_NAME extra args '{"key": "value"}' --payload-type=struct\
"""
        expected = """\
$ gcloud beta logging write LOG_NAME extra args '{"key": "value"}' \\
      --payload-type=struct\
"""
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)
コード例 #3
0
    def testSplitLongCommandExampleLineWithFlags(self):
        example = """\
$ gcloud compute instances list --verbosity=info --format=json --xyz abc --abc=xyz\
"""
        expected = """\
$ gcloud compute instances list --verbosity=info --format=json \\
      --xyz abc --abc=xyz\
"""
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)
コード例 #4
0
    def testgSplitLongCommandExampleLineOffByOne(self):
        example = """\
$ gcloud alpha compute ssh example-instance --zone us-central1-a -- -vvv -L 80:%INSTANCE%:80\
"""
        expected = """\
$ gcloud alpha compute ssh example-instance --zone us-central1-a \\
      -- -vvv -L 80:%INSTANCE%:80\
"""
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)
コード例 #5
0
    def testgSplitLongCommandExampleLineCloseToBoundary(self):
        example = """\
$ gcloud alpha compute instance-templates create example-instance --scopes compute-rw,[email protected]=storage-rw\
"""
        expected = """\
$ gcloud alpha compute instance-templates create example-instance \\
      --scopes compute-rw,[email protected]=storage-rw\
"""
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)
コード例 #6
0
    def testgSplitLongCommandExampleLineWithDoubleQuoteSplit(self):
        example = """\
$ gcloud alpha dns record-sets transaction remove -z MANAGED_ZONE --name my.domain. --ttl 2345 --type TXT "Hello world","Bye world"\
"""
        expected = """\
$ gcloud alpha dns record-sets transaction remove -z MANAGED_ZONE \\
      --name my.domain. --ttl 2345 --type TXT \\
      "Hello world","Bye world"\
"""
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)
コード例 #7
0
    def testgSplitLongCommandExampleLineWithDoubleQuote(self):
        example = """\
$ gcloud compute instances list --format="table[box,title=Instances](name:sort=1, zone:title=zone, status)"\
"""
        expected = """\
$ gcloud compute instances list \\
      --format="table[box,title=Instances](name:sort=1,\\
   zone:title=zone, status)"\
"""
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)
コード例 #8
0
    def testgSplitLongCommandExampleLineWithReallyLongArgWithSlash(self):
        example = """\
$ gcloud compute instances list --format=http://zyx.bca/abcdefg/hijklmno/pqrstuvwxyz/abcdefg/hijklmno/pqrstuvwxyz\
"""
        expected = """\
$ gcloud compute instances list \\
      --format=http://zyx.bca/abcdefg/hijklmno/pqrstuvwxyz/abcdefg/\\
  hijklmno/pqrstuvwxyz\
"""
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)
コード例 #9
0
    def testgSplitLongCommandExampleLineWithReallyLongArg(self):
        example = """\
$ gcloud compute instances list --format=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz\
"""
        expected = """\
$ gcloud compute instances list \\
      --format=abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabc\\
  defghijklmnopqrstuvwxyz\
"""
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)
コード例 #10
0
    def testgSplitLongCommandExampleLineStrangeSplit(self):
        example = """\
$ python -c "from time import mktime, strptime; print int(mktime(strptime('01 July 2015', '%d %B %Y')))"\
"""
        expected = """\
$ python \\
      -c \\
      "from time import mktime, strptime; print\\
   int(mktime(strptime('01 July 2015', '%d %B %Y')))"\
"""
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)
コード例 #11
0
    def testgSplitLongCommandExampleLineWithReallyLongDoubleQuote(self):
        example = """\
$ gcloud compute instances list --format="table(name:sort=2:align=center:label=INSTANCE, zone:sort=1:reverse, creationTimestamp.date('%Y-%m-%d'):label=START)"\
"""
        expected = """\
$ gcloud compute instances list \\
      --format="table(name:sort=2:align=center:label=INSTANCE,\\
   zone:sort=1:reverse,\\
   creationTimestamp.date('%Y-%m-%d'):label=START)"\
"""
        actual = markdown.ExampleCommandLineSplitter().Split(example)
        self.assertEqual(expected, actual)