LCOV - code coverage report
Current view: top level - modules/script - format.js (source / functions) Coverage Total Hit
Test: gjs- Code Coverage Lines: 60.0 % 5 3
Test Date: 2024-10-21 03:03:24 Functions: 66.7 % 3 2
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: - 0 0

             Branch data     Line data    Source code
       1                 :           1 : // -*- mode: js; js-indent-level: 4; indent-tabs-mode: nil -*-
       2                 :             : // SPDX-License-Identifier: MIT OR LGPL-2.0-or-later
       3                 :             : // SPDX-FileCopyrightText: 2012 Red Hat, Inc.
       4                 :             : // SPDX-FileCopyrightText: 2012 Giovanni Campagna <scampa.giovanni@gmail.com>
       5                 :             : 
       6                 :             : /* exported format, printf, vprintf */
       7                 :             : 
       8                 :           1 : var {vprintf} = imports._format;
       9                 :             : 
      10                 :           0 : function printf(fmt, ...args) {
      11                 :           0 :     print(vprintf(fmt, args));
      12                 :             : }
      13                 :             : 
      14                 :             : /*
      15                 :             :  * This function is intended to extend the String object and provide a
      16                 :             :  * String.format API for string formatting.
      17                 :             :  * It has to be set up using String.prototype.format = Format.format;
      18                 :             :  * Usage:
      19                 :             :  * "somestring %s %d".format('hello', 5);
      20                 :             :  * It supports %s, %d, %x and %f.
      21                 :             :  * For %f it also supports precisions like "%.2f".format(1.526).
      22                 :             :  * All specifiers can be prefixed with a minimum field width, e.g.
      23                 :             :  * "%5s".format("foo").
      24                 :             :  * Unless the width is prefixed with '0', the formatted string will be padded
      25                 :             :  * with spaces.
      26                 :             :  */
      27                 :          18 : function format(...args) {
      28                 :          18 :     return vprintf(this, args);
      29                 :             : }
        

Generated by: LCOV version 2.0-1