text:
import {
  AfterContentInit,
  Component,
  ContentChildren,
  ElementRef,
  Input,
  Optional,
  Output,
  QueryList,
  ChangeDetectionStrategy,
  EventEmitter,
  Renderer2,
  ViewEncapsulation,
  NgZone,
  OnDestroy, Inject,
} from '@angular/core';
import {Dir, coerceBooleanProperty} from '../core';
import {FocusTrapFactory, FocusTrap} from '../core/a11y/focus-trap';
import {ESCAPE} from '../core/keyboard/keycodes';
import 'rxjs/add/operator/first';
import {DOCUMENT} from '@angular/platform-browser';

/** Throws an exception when two MdSidenav are matching the same side. */
export function throwMdDuplicatedSidenavError(align: string) {
  throw Error(`A sidenav was already declared for 'align="${align}"'`);
}

/** Sidenav toggle promise result. */
export class MdSidenavToggleResult {
  constructor(public type: 'open' | 'close', public animationFinished: boolean) {}
}

/**
 * <md-sidenav> component.
 *
 * This component corresponds to the drawer of the sidenav.
 *
 * Please refer to README.md for examples on how to use it.
 */
@Component({
  moduleId: module.id,
  selector: 'md-sidenav, mat-sidenav',
  // TODO(mmalerba): move template to separate file.
  templateUrl: 'sidenav.html',
  host: {
    'class': 'mat-sidenav',
    '(transitionend)': '_onTransitionEnd($event)',
    '(keydown)': 'handleKeydown($event)',
    // must prevent the browser from aligning text based on value
    '[attr.align]': 'null',
    '[class.mat-sidenav-closed]': '_isClosed',
    '[class.mat-sidenav-closing]': '_isClosing',
    '[class.mat-sidenav-end]': '_isEnd',
    '[class.mat-sidenav-opened]': '_isOpened',
    '[class.mat-sidenav-opening]': '_isOpening',
    '[class.mat-sidenav-over]': '_modeOver',
    '[class.mat-sidenav-push]': '_modePush',
    '[class.mat-sidenav-side]': '_modeSide',
    'tabIndex': '-1'
  },
  changeDetection: ChangeDetectionStrategy.OnPush,
  encapsulation: ViewEncapsulation.None,
})
export class MdSidenav implements AfterContentInit, OnDestroy {
  private _focusTrap: FocusTrap;

  /** Alignment of the sidenav (direction neutral); whether 'start' or 'end'. */
  private _align: 'start' | 'end' = 'start';

  /** Direction which the sidenav is aligned in. */
  @Input()
  get align() { return this._align; }
  set align(value) {
    // Make sure we have a valid value.
    value = (value == 'end') ? 'end' : 'start';
    if (value != this._align) {
      this._align = value;
      this.onAlignChanged.emit();
    }
  }

  /** Mode of the sidenav; one of 'over', 'push' or 'side'. */
  @Input() mode: 'over' | 'push' | 'side' = 'over';

  /** Whether the sidenav can be closed with the escape key or not. */
  @Input()
  get disableClose(): boolean { return this._disableClose; }
  set disableClose(value: boolean) { this._disableClose = coerceBooleanProperty(value); }
  private _disableClose: boolean = false;

  /** Whether the sidenav is opened. */
  _opened: boolean = false;

  /** Event emitted when the sidenav is being opened. Use this to synchronize animations. */
  @Output('open-start') onOpenStart = new EventEmitter<void>();

  /** Event emitted when the sidenav is fully opened. */
  @Output('open') onOpen = new EventEmitter<void>();

  /** Event emitted when the sidenav is being closed. Use this to synchronize animations. */
  @Output('close-start') onCloseStart = new EventEmitter<void>();

  /** Event emitted when the sidenav is fully closed. */
  @Output('close') onClose = new EventEmitter<void>();

  /** Event emitted when the sidenav alignment changes. */
  @Output('align-changed') onAlignChanged = new EventEmitter<void>();

  /** The current toggle animation promise. `null` if no animation is in progress. */
  private _toggleAnimationPromise: Promise<MdSidenavToggleResult> = null;

  /**
   * The current toggle animation promise resolution function.
   * `null` if no animation is in progress.
   */
  private _resolveToggleAnimationPromise: (animationFinished: boolean) => void = null;

  get isFocusTrapEnabled() {
    // The focus trap is only enabled when the sidenav is open in any mode other than side.
    return this.opened && this.mode !== 'side';
  }

  /**
   * @param _elementRef The DOM element reference. Used for transition and width calculation.
   *     If not available we do not hook on transitions.
   */
  constructor(private _elementRef: ElementRef,
              private _focusTrapFactory: FocusTrapFactory,
              @Optional() @Inject(DOCUMENT) private _doc: any) {
    this.onOpen.subscribe(() => {
      if (this._doc) {
        this._elementFocusedBeforeSidenavWasOpened = this._doc.activeElement as HTMLElement;
      }

      if (this.isFocusTrapEnabled && this._focusTrap) {
        this._focusTrap.focusInitialElementWhenReady();
      }
    });

    this.onClose.subscribe(() => this._restoreFocus());
  }

  /**
   * If focus is currently inside the sidenav, restores it to where it was before the sidenav
   * opened.
   */
  private _restoreFocus() {
    let activeEl = this._doc && this._doc.activeElement;
    if (activeEl && this._elementRef.nativeElement.contains(activeEl)) {
      if (this._elementFocusedBeforeSidenavWasOpened instanceof HTMLElement) {
        this._elementFocusedBeforeSidenavWasOpened.focus();
      } else {
        this._elementRef.nativeElement.blur();
      }
    }

    this._elementFocusedBeforeSidenavWasOpened = null;
  }

  ngAfterContentInit() {
    this._focusTrap = this._focusTrapFactory.create(this._elementRef.nativeElement);
    this._focusTrap.enabled = this.isFocusTrapEnabled;

    // This can happen when the sidenav is set to opened in
    // the template and the transition hasn't ended.
    if (this._toggleAnimationPromise) {
      this._resolveToggleAnimationPromise(true);
      this._toggleAnimationPromise = this._resolveToggleAnimationPromise = null;
    }
  }

  ngOnDestroy() {
    if (this._focusTrap) {
      this._focusTrap.destroy();
    }
  }

  /**
   * Whether the sidenav is opened. We overload this because we trigger an event when it
   * starts or end.
   */
  @Input()
  get opened(): boolean { return this._opened; }
  set opened(v: boolean) {
    this.toggle(coerceBooleanProperty(v));
  }

  /** Open this sidenav, and return a Promise that will resolve when it's fully opened (or get
   * rejected if it didn't). */
  open(): Promise<MdSidenavToggleResult> {
    return this.toggle(true);
  }

  /**
   * Close this sidenav, and return a Promise that will resolve when it's fully closed (or get
   * rejected if it didn't).
   */
  close(): Promise<MdSidenavToggleResult> {
    return this.toggle(false);
  }

  /**
   * Toggle this sidenav. This is equivalent to calling open() when it's already opened, or
   * close() when it's closed.
   * @param isOpen Whether the sidenav should be open.
   * @returns Resolves with the result of whether the sidenav was opened or closed.
   */
  toggle(isOpen: boolean = !this.opened): Promise<MdSidenavToggleResult> {
    // Shortcut it if we're already opened.
    if (isOpen === this.opened) {
      return this._toggleAnimationPromise ||
          Promise.resolve(new MdSidenavToggleResult(isOpen ? 'open' : 'close', true));
    }

    this._opened = isOpen;

    if (this._focusTrap) {
      this._focusTrap.enabled = this.isFocusTrapEnabled;
    }

    if (isOpen) {
      this.onOpenStart.emit();
    } else {
      this.onCloseStart.emit();
    }

    if (this._toggleAnimationPromise) {
      this._resolveToggleAnimationPromise(false);
    }
    this._toggleAnimationPromise = new Promise<MdSidenavToggleResult>(resolve => {
      this._resolveToggleAnimationPromise = animationFinished =>
          resolve(new MdSidenavToggleResult(isOpen ? 'open' : 'close', animationFinished));
    });
    return this._toggleAnimationPromise;
  }

  /**
   * Handles the keyboard events.
   * @docs-private
   */
  handleKeydown(event: KeyboardEvent) {
    if (event.keyCode === ESCAPE && !this.disableClose) {
      this.close();
      event.stopPropagation();
    }
  }

  /**
   * When transition has finished, set the internal state for classes and emit the proper event.
   * The event passed is actually of type TransitionEvent, but that type is not available in
   * Android so we use any.
   */
  _onTransitionEnd(transitionEvent: TransitionEvent) {
    if (transitionEvent.target == this._elementRef.nativeElement
        // Simpler version to check for prefixes.
        && transitionEvent.propertyName.endsWith('transform')) {
      if (this._opened) {
        this.onOpen.emit();
      } else {
        this.onClose.emit();
      }

      if (this._toggleAnimationPromise) {
        this._resolveToggleAnimationPromise(true);
        this._toggleAnimationPromise = this._resolveToggleAnimationPromise = null;
      }
    }
  }

  get _isClosing() {
    return !this._opened && !!this._toggleAnimationPromise;
  }
  get _isOpening() {
    return this._opened && !!this._toggleAnimationPromise;
  }
  get _isClosed() {
    return !this._opened && !this._toggleAnimationPromise;
  }
  get _isOpened() {
    return this._opened && !this._toggleAnimationPromise;
  }
  get _isEnd() {
    return this.align == 'end';
  }
  get _modeSide() {
    return this.mode == 'side';
  }
  get _modeOver() {
    return this.mode == 'over';
  }
  get _modePush() {
    return this.mode == 'push';
  }

  get _width() {
    if (this._elementRef.nativeElement) {
      return this._elementRef.nativeElement.offsetWidth;
    }
    return 0;
  }

  private _elementFocusedBeforeSidenavWasOpened: HTMLElement = null;
}

/**
 * <md-sidenav-container> component.
 *
 * This is the parent component to one or two <md-sidenav>s that validates the state internally
 * and coordinates the backdrop and content styling.
 */
@Component({
  moduleId: module.id,
  selector: 'md-sidenav-container, mat-sidenav-container',
  // Do not use ChangeDetectionStrategy.OnPush. It does not work for this component because
  // technically it is a sibling of MdSidenav (on the content tree) and isn't updated when MdSidenav
  // changes its state.
  templateUrl: 'sidenav-container.html',
  styleUrls: [
    'sidenav.css',
    'sidenav-transitions.css',
  ],
  host: {
    'class': 'mat-sidenav-container',
    '[class.mat-sidenav-transition]': '_enableTransitions',
  },
  encapsulation: ViewEncapsulation.None,
})
export class MdSidenavContainer implements AfterContentInit {
  @ContentChildren(MdSidenav) _sidenavs: QueryList<MdSidenav>;

  /** The sidenav child with the `start` alignment. */
  get start() { return this._start; }

  /** The sidenav child with the `end` alignment. */
  get end() { return this._end; }

  /** Event emitted when the sidenav backdrop is clicked. */
  @Output() backdropClick = new EventEmitter<void>();

  /** The sidenav at the start/end alignment, independent of direction. */
  private _start: MdSidenav;
  private _end: MdSidenav;

  /**
   * The sidenav at the left/right. When direction changes, these will change as well.
   * They're used as aliases for the above to set the left/right style properly.
   * In LTR, _left == _start and _right == _end.
   * In RTL, _left == _end and _right == _start.
   */
  private _left: MdSidenav;
  private _right: MdSidenav;

  /** Whether to enable open/close trantions. */
  _enableTransitions = false;

  constructor(@Optional() private _dir: Dir, private _element: ElementRef,
              private _renderer: Renderer2, private _ngZone: NgZone) {
    // If a `Dir` directive exists up the tree, listen direction changes and update the left/right
    // properties to point to the proper start/end.
    if (_dir != null) {
      _dir.dirChange.subscribe(() => this._validateDrawers());
    }
  }

  ngAfterContentInit() {
    // On changes, assert on consistency.
    this._sidenavs.changes.subscribe(() => this._validateDrawers());
    this._sidenavs.forEach((sidenav: MdSidenav) => {
      this._watchSidenavToggle(sidenav);
      this._watchSidenavAlign(sidenav);
    });
    this._validateDrawers();

    // Give the view a chance to render the initial state, then enable transitions.
    this._ngZone.onMicrotaskEmpty.first().subscribe(() => this._enableTransitions = true);
  }

  /** Calls `open` of both start and end sidenavs */
  public open() {
    return Promise.all([this._start, this._end].map(sidenav => sidenav && sidenav.open()));
  }

  /** Calls `close` of both start and end sidenavs */
  public close() {
    return Promise.all([this._start, this._end].map(sidenav => sidenav && sidenav.close()));
  }

  /**
   * Subscribes to sidenav events in order to set a class on the main container element when the
   * sidenav is open and the backdrop is visible. This ensures any overflow on the container element
   * is properly hidden.
   */
  private _watchSidenavToggle(sidenav: MdSidenav): void {
    if (!sidenav || sidenav.mode === 'side') { return; }
    sidenav.onOpen.subscribe(() => this._setContainerClass(true));
    sidenav.onClose.subscribe(() => this._setContainerClass(false));
  }

  /**
   * Subscribes to sidenav onAlignChanged event in order to re-validate drawers when the align
   * changes.
   */
  private _watchSidenavAlign(sidenav: MdSidenav): void {
    if (!sidenav) {
      return;
    }
    // NOTE: We need to wait for the microtask queue to be empty before validating,
    // since both drawers may be swapping sides at the same time.
    sidenav.onAlignChanged.subscribe(() =>
        this._ngZone.onMicrotaskEmpty.first().subscribe(() => this._validateDrawers()));
  }

  /** Toggles the 'mat-sidenav-opened' class on the main 'md-sidenav-container' element. */
  private _setContainerClass(isAdd: boolean): void {
    if (isAdd) {
      this._renderer.addClass(this._element.nativeElement, 'mat-sidenav-opened');
    } else {
      this._renderer.removeClass(this._element.nativeElement, 'mat-sidenav-opened');
    }
  }

  /** Validate the state of the sidenav children components. */
  private _validateDrawers() {
    this._start = this._end = null;

    // Ensure that we have at most one start and one end sidenav.
    // NOTE: We must call toArray on _sidenavs even though it's iterable
    // (see https://github.com/Microsoft/TypeScript/issues/3164).
    for (let sidenav of this._sidenavs.toArray()) {
      if (sidenav.align == 'end') {
        if (this._end != null) {
          throwMdDuplicatedSidenavError('end');
        }
        this._end = sidenav;
      } else {
        if (this._start != null) {
          throwMdDuplicatedSidenavError('start');
        }
        this._start = sidenav;
      }
    }

    this._right = this._left = null;

    // Detect if we're LTR or RTL.
    if (this._dir == null || this._dir.value == 'ltr') {
      this._left = this._start;
      this._right = this._end;
    } else {
      this._left = this._end;
      this._right = this._start;
    }
  }

  _onBackdropClicked() {
    this.backdropClick.emit();
    this._closeModalSidenav();
  }

  _closeModalSidenav() {
    // Close all open sidenav's where closing is not disabled and the mode is not `side`.
    [this._start, this._end]
      .filter(sidenav => sidenav && !sidenav.disableClose && sidenav.mode !== 'side')
      .forEach(sidenav => sidenav.close());
  }

  _isShowingBackdrop(): boolean {
    return (this._isSidenavOpen(this._start) && this._start.mode != 'side')
        || (this._isSidenavOpen(this._end) && this._end.mode != 'side');
  }

  private _isSidenavOpen(side: MdSidenav): boolean {
    return side != null && side.opened;
  }

  /**
   * Return the width of the sidenav, if it's in the proper mode and opened.
   * This may relayout the view, so do not call this often.
   * @param sidenav
   * @param mode
   */
  private _getSidenavEffectiveWidth(sidenav: MdSidenav, mode: string): number {
    return (this._isSidenavOpen(sidenav) && sidenav.mode == mode) ? sidenav._width : 0;
  }

  _getMarginLeft() {
    return this._getSidenavEffectiveWidth(this._left, 'side');
  }

  _getMarginRight() {
    return this._getSidenavEffectiveWidth(this._right, 'side');
  }

  _getPositionLeft() {
    return this._getSidenavEffectiveWidth(this._left, 'push');
  }

  _getPositionRight() {
    return this._getSidenavEffectiveWidth(this._right, 'push');
  }

  /**
   * Returns the horizontal offset for the content area.  There should never be a value for both
   * left and right, so by subtracting the right value from the left value, we should always get
   * the appropriate offset.
   */
  _getPositionOffset() {
    return this._getPositionLeft() - this._getPositionRight();
  }

  /**
   * This is using [ngStyle] rather than separate [style...] properties because [style.transform]
   * doesn't seem to work right now.
   */
  _getStyles() {
    return {
      marginLeft: `${this._getMarginLeft()}px`,
      marginRight: `${this._getMarginRight()}px`,
      transform: `translate3d(${this._getPositionOffset()}px, 0, 0)`
    };
  }
}


text:
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.WindowsAzure.Storage.Table;
using Moq;
using WindowsAzure.Table;
using WindowsAzure.Table.RequestExecutor;
using WindowsAzure.Tests.Common;
using WindowsAzure.Tests.Samples;
using Xunit;

namespace WindowsAzure.Tests.Table.Context
{
    public sealed class AddOrMergeEntitiesTests
    {
        [Fact]
        public void AddOrMergeEntities()
        {
            // Arrange
            Mock<ITableRequestExecutor<Country>> mock = MocksFactory.GetQueryExecutorMock<Country>();
            CloudTableClient tableClient = ObjectsFactory.GetCloudTableClient();
            var context = new TableSet<Country>(tableClient)
                {
                    RequestExecutor = mock.Object
                };

            var countries = ObjectsFactory.GetCountries();

            // Act
            var result = context.AddOrMerge(countries);

            // Assert
            Assert.NotNull(result);
            mock.Verify(executor => executor.ExecuteBatches(countries, TableOperation.InsertOrMerge), Times.Once());
            Assert.Equal(countries, result);
        }

        [Fact]
        public void AddOrMergeEntitiesWithNullParameter()
        {
            // Arrange
            Mock<ITableRequestExecutor<Country>> mock = MocksFactory.GetQueryExecutorMock<Country>();
            CloudTableClient tableClient = ObjectsFactory.GetCloudTableClient();
            var context = new TableSet<Country>(tableClient)
                {
                    RequestExecutor = mock.Object
                };

            IEnumerable<Country> result = null;

            // Act
            Assert.Throws<ArgumentNullException>(() => { result = context.AddOrMerge((IEnumerable<Country>)null); });

            // Assert
            Assert.Null(result);
            mock.Verify(executor => executor.ExecuteBatches(It.IsAny<IEnumerable<Country>>(), It.IsAny<Func<ITableEntity, TableOperation>>()), Times.Never());
        }

        [Fact]
        public void AddOrMergeEmptyCollection()
        {
            // Arrange
            Mock<ITableRequestExecutor<Country>> mock = MocksFactory.GetQueryExecutorMock<Country>();
            CloudTableClient tableClient = ObjectsFactory.GetCloudTableClient();
            var context = new TableSet<Country>(tableClient)
            {
                RequestExecutor = mock.Object
            };

            var countries = new List<Country>();

            // Act
            var result = context.AddOrMerge(countries);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(countries, result);
        }

        [Fact]
        public async Task AddOrMergeEntitiesAsync()
        {
            // Arrange
            Mock<ITableRequestExecutor<Country>> mock = MocksFactory.GetQueryExecutorMock<Country>();
            CloudTableClient tableClient = ObjectsFactory.GetCloudTableClient();
            var context = new TableSet<Country>(tableClient)
                {
                    RequestExecutor = mock.Object
                };

            var countries = ObjectsFactory.GetCountries();

            // Act
            var result = await context.AddOrMergeAsync(countries);

            // Assert
            Assert.NotNull(result);
            mock.Verify(executor => executor.ExecuteBatchesAsync(countries, TableOperation.InsertOrMerge, It.IsAny<CancellationToken>()));
            Assert.Equal(countries, result);
        }

        [Fact]
        public async Task AddOrMergeEntitiesWithNullParameterAsync()
        {
            // Arrange
            Mock<ITableRequestExecutor<Country>> mock = MocksFactory.GetQueryExecutorMock<Country>();
            CloudTableClient tableClient = ObjectsFactory.GetCloudTableClient();
            var context = new TableSet<Country>(tableClient)
                {
                    RequestExecutor = mock.Object
                };

            IEnumerable<Country> result = null;

            // Act
            try
            {
                result = await context.AddOrMergeAsync((IEnumerable<Country>)null, CancellationToken.None);
            }
            catch (ArgumentNullException)
            {
            }

            // Assert
            Assert.Null(result);
            mock.Verify(executor => executor.ExecuteBatches(It.IsAny<IEnumerable<Country>>(), It.IsAny<Func<ITableEntity, TableOperation>>()), Times.Never());
        }

        [Fact]
        public async Task AddOrMergeEmptyCollectionAsync()
        {
            // Arrange
            Mock<ITableRequestExecutor<Country>> mock = MocksFactory.GetQueryExecutorMock<Country>();
            CloudTableClient tableClient = ObjectsFactory.GetCloudTableClient();
            var context = new TableSet<Country>(tableClient)
            {
                RequestExecutor = mock.Object
            };

            var countries = new List<Country>();

            // Act
            var result = await context.AddOrMergeAsync(countries);

            // Assert
            Assert.NotNull(result);
            Assert.Equal(countries, result);
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
namespace blink {

void NeedsFinalizer::Trace(Visitor* visitor)
{
    visitor->Trace(m_as);
    A::Trace(visitor);
}

void AlsoNeedsFinalizer::Trace(Visitor* visitor)
{
    visitor->Trace(m_bs);
    A::Trace(visitor);
}

void DoesNotNeedFinalizer::Trace(Visitor* visitor)
{
    visitor->Trace(m_bs);
    A::Trace(visitor);
}

void AlsoDoesNotNeedFinalizer::Trace(Visitor* visitor)
{
    visitor->Trace(m_as);
    visitor->Trace(m_cs);
    A::Trace(visitor);
}

}


text:
using System;
using System.Reflection;
using ServiceStack.Text;

namespace ServiceStack.Common.Reflection
{

    public static class PropertyAccessor
    {
        public static Func<TEntity, object> GetPropertyFn<TEntity>(string propertyName)
        {
            return new PropertyAccessor<TEntity>(propertyName).GetPropertyFn();
        }

        //public static Func<object, object> GetPropertyFnByType(Type type, string propertyName)
        //{
        //    var mi = typeof(PropertyAccessor).GetMethod("GetPropertyFn");
        //    var genericMi = mi.MakeGenericMethod(type);
        //    var getPropertyFn = genericMi.Invoke(null, new object[] { propertyName });

        //    return (Func<object, object>)getPropertyFn;
        //}

        public static Action<TEntity, object> SetPropertyFn<TEntity>(string propertyName)
        {
            return new PropertyAccessor<TEntity>(propertyName).SetPropertyFn();
        }

        //public static Action<object, object> SetPropertyFnByType(Type type, string propertyName)
        //{
        //    var mi = typeof(PropertyAccessor).GetMethod("SetPropertyFn");
        //    var genericMi = mi.MakeGenericMethod(type);
        //    var setPropertyFn = genericMi.Invoke(null, new object[] { propertyName });

        //    return (Action<object, object>)setPropertyFn;
        //}
    }

    public class PropertyAccessor<TEntity>
    {
        readonly PropertyInfo pi;
        public string Name { get; set; }
        public Type PropertyType { get; set; }

        private readonly Func<TEntity, object> getPropertyFn;
        private readonly Action<TEntity, object> setPropertyFn;

        public PropertyAccessor(string propertyName)
        {
            this.pi = typeof(TEntity).GetPropertyInfo(propertyName);
            this.Name = propertyName;
            this.PropertyType = pi.PropertyType;

            getPropertyFn = StaticAccessors<TEntity>.ValueUnTypedGetPropertyTypeFn(pi);
            setPropertyFn = StaticAccessors<TEntity>.ValueUnTypedSetPropertyTypeFn(pi);
        }

        public Func<TEntity, object> GetPropertyFn()
        {
            return getPropertyFn;
        }

        public Action<TEntity, object> SetPropertyFn()
        {
            return setPropertyFn;
        }

        /// <summary>
        /// Func to get the Strongly-typed field
        /// </summary>
        public Func<TEntity, TId> TypedGetPropertyFn<TId>()
        {
            return StaticAccessors<TEntity>.TypedGetPropertyFn<TId>(pi);
        }

        /// <summary>
        /// Required to cast the return ValueType to an object for caching
        /// </summary>
        public Func<TEntity, object> ValueTypedGetPropertyFn<TId>()
        {
            return StaticAccessors<TEntity>.ValueUnTypedGetPropertyFn<TId>(pi);
        }

        public Func<object, object> UnTypedGetPropertyFn<TId>()
        {
            return StaticAccessors<TEntity>.UnTypedGetPropertyFn<TId>(pi);
        }

        /// <summary>
        /// Func to set the Strongly-typed field
        /// </summary>
        public Action<TEntity, TId> TypedSetPropertyFn<TId>()
        {
            return StaticAccessors<TEntity>.TypedSetPropertyFn<TId>(pi);
        }

        /// <summary>
        /// Required to cast the ValueType to an object for caching
        /// </summary>
        public Action<TEntity, object> ValueTypesSetPropertyFn<TId>()
        {
            return StaticAccessors<TEntity>.ValueUnTypedSetPropertyFn<TId>(pi);
        }

        /// <summary>
        /// Required to cast the ValueType to an object for caching
        /// </summary>
        public Action<object, object> UnTypedSetPropertyFn<TId>()
        {
            return StaticAccessors<TEntity>.UnTypedSetPropertyFn<TId>(pi);
        }
    }
}


text:
<?php
return array(
    'Doc\\V1\\Rest\\FooBar\\Controller' => array(
        'description' => 'per rest controller description',
        'entity' => array(
            'GET' => array(
                'description' => 'General description for GET',
                'request' => 'Request for GET doc updated',
            ),
        ),
        'collection' => array(
            'description' => 'General in rest collection',
            'POST' => array(
                'request' => 'Request for POST doc in collection',
                'description' => 'General POST doc in collection',
            ),
        ),
    ),
    'Doc\\V1\\Rpc\\BazBam\\Controller' => array(
        'description' => 'General RPC docs',
        'GET' => array(
            'description' => 'General GET docs',
            'request' => 'General GET docs for request',
            'response' => 'updated description for GET response',
        ),
    ),
);


text:
//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Runtime Version:4.0.30319.42000
//
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

namespace KindergartentManagerment.Resources {
    using System;

    /// <summary>
    ///   A strongly-typed resource class, for looking up localized strings, etc.
    /// </summary>
    // This class was auto-generated by the StronglyTypedResourceBuilder
    // class via a tool like ResGen or Visual Studio.
    // To add or remove a member, edit your .ResX file then rerun ResGen
    // with the /str option, or rebuild your VS project.
    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
    public class CalendarResource {

        private static global::System.Resources.ResourceManager resourceMan;

        private static global::System.Globalization.CultureInfo resourceCulture;

        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
        internal CalendarResource() {
        }

        /// <summary>
        ///   Returns the cached ResourceManager instance used by this class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Resources.ResourceManager ResourceManager {
            get {
                if (object.ReferenceEquals(resourceMan, null)) {
                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("KindergartentManagerment.Resources.CalendarResource", typeof(CalendarResource).Assembly);
                    resourceMan = temp;
                }
                return resourceMan;
            }
        }

        /// <summary>
        ///   Overrides the current thread's CurrentUICulture property for all
        ///   resource lookups using this strongly typed resource class.
        /// </summary>
        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
        public static global::System.Globalization.CultureInfo Culture {
            get {
                return resourceCulture;
            }
            set {
                resourceCulture = value;
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Create Event.
        /// </summary>
        public static string Create_event {
            get {
                return ResourceManager.GetString("Create_event", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Detail.
        /// </summary>
        public static string EVENT_DETAIL {
            get {
                return ResourceManager.GetString("EVENT_DETAIL", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to End.
        /// </summary>
        public static string EVENT_END {
            get {
                return ResourceManager.GetString("EVENT_END", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Group.
        /// </summary>
        public static string EVENT_GROUP {
            get {
                return ResourceManager.GetString("EVENT_GROUP", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Manager.
        /// </summary>
        public static string EVENT_MANAGER {
            get {
                return ResourceManager.GetString("EVENT_MANAGER", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Name.
        /// </summary>
        public static string EVENT_NAME {
            get {
                return ResourceManager.GetString("EVENT_NAME", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Start.
        /// </summary>
        public static string EVENT_START {
            get {
                return ResourceManager.GetString("EVENT_START", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Color.
        /// </summary>
        public static string EVENT_STATUS_COLOR {
            get {
                return ResourceManager.GetString("EVENT_STATUS_COLOR", resourceCulture);
            }
        }

        /// <summary>
        ///   Looks up a localized string similar to Is All Day.
        /// </summary>
        public static string ISALLDAY {
            get {
                return ResourceManager.GetString("ISALLDAY", resourceCulture);
            }
        }
    }
}


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using System.Diagnostics;
using System.Globalization;

namespace Microsoft.CodeAnalysis
{
    /// <summary>
    /// Defines a set of helper methods to classify Unicode characters.
    /// </summary>
    internal static partial class UnicodeCharacterUtilities
    {
        public static bool IsIdentifierStartCharacter(char ch)
        {
            // identifier-start-character:
            //   letter-character
            //   _ (the underscore character U+005F)

            if (ch < 'a') // '\u0061'
            {
                if (ch < 'A') // '\u0041'
                {
                    return false;
                }

                return ch <= 'Z'  // '\u005A'
                    || ch == '_'; // '\u005F'
            }

            if (ch <= 'z') // '\u007A'
            {
                return true;
            }

            if (ch <= '\u007F') // max ASCII
            {
                return false;
            }

            return IsLetterChar(CharUnicodeInfo.GetUnicodeCategory(ch));
        }

        /// <summary>
         /// Returns true if the Unicode character can be a part of an identifier.
         /// </summary>
         /// <param name="ch">The Unicode character.</param>
        public static bool IsIdentifierPartCharacter(char ch)
        {
            // identifier-part-character:
            //   letter-character
            //   decimal-digit-character
            //   connecting-character
            //   combining-character
            //   formatting-character

            if (ch < 'a') // '\u0061'
            {
                if (ch < 'A') // '\u0041'
                {
                    return ch >= '0'  // '\u0030'
                        && ch <= '9'; // '\u0039'
                }

                return ch <= 'Z'  // '\u005A'
                    || ch == '_'; // '\u005F'
            }

            if (ch <= 'z') // '\u007A'
            {
                return true;
            }

            if (ch <= '\u007F') // max ASCII
            {
                return false;
            }

            UnicodeCategory cat = CharUnicodeInfo.GetUnicodeCategory(ch);
            return IsLetterChar(cat)
                || IsDecimalDigitChar(cat)
                || IsConnectingChar(cat)
                || IsCombiningChar(cat)
                || IsFormattingChar(cat);
        }

        /// <summary>
        /// Check that the name is a valid Unicode identifier.
        /// </summary>
        public static bool IsValidIdentifier(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                return false;
            }

            if (!IsIdentifierStartCharacter(name[0]))
            {
                return false;
            }

            int nameLength = name.Length;
            for (int i = 1; i < nameLength; i++) //NB: start at 1
            {
                if (!IsIdentifierPartCharacter(name[i]))
                {
                    return false;
                }
            }

            return true;
        }

        private static bool IsLetterChar(UnicodeCategory cat)
        {
            // letter-character:
            //   A Unicode character of classes Lu, Ll, Lt, Lm, Lo, or Nl
            //   A Unicode-escape-sequence representing a character of classes Lu, Ll, Lt, Lm, Lo, or Nl

            switch (cat)
            {
                case UnicodeCategory.UppercaseLetter:
                case UnicodeCategory.LowercaseLetter:
                case UnicodeCategory.TitlecaseLetter:
                case UnicodeCategory.ModifierLetter:
                case UnicodeCategory.OtherLetter:
                case UnicodeCategory.LetterNumber:
                    return true;
            }

            return false;
        }

        private static bool IsCombiningChar(UnicodeCategory cat)
        {
            // combining-character:
            //   A Unicode character of classes Mn or Mc
            //   A Unicode-escape-sequence representing a character of classes Mn or Mc

            switch (cat)
            {
                case UnicodeCategory.NonSpacingMark:
                case UnicodeCategory.SpacingCombiningMark:
                    return true;
            }

            return false;
        }

        private static bool IsDecimalDigitChar(UnicodeCategory cat)
        {
            // decimal-digit-character:
            //   A Unicode character of the class Nd
            //   A unicode-escape-sequence representing a character of the class Nd

            return cat == UnicodeCategory.DecimalDigitNumber;
        }

        private static bool IsConnectingChar(UnicodeCategory cat)
        {
            // connecting-character:
            //   A Unicode character of the class Pc
            //   A unicode-escape-sequence representing a character of the class Pc

            return cat == UnicodeCategory.ConnectorPunctuation;
        }

        /// <summary>
        /// Returns true if the Unicode character is a formatting character (Unicode class Cf).
        /// </summary>
        /// <param name="ch">The Unicode character.</param>
        internal static bool IsFormattingChar(char ch)
        {
            // There are no FormattingChars in ASCII range

            return ch > 127 && IsFormattingChar(CharUnicodeInfo.GetUnicodeCategory(ch));
        }

        /// <summary>
        /// Returns true if the Unicode character is a formatting character (Unicode class Cf).
        /// </summary>
        /// <param name="cat">The Unicode character.</param>
        private static bool IsFormattingChar(UnicodeCategory cat)
        {
            // formatting-character:
            //   A Unicode character of the class Cf
            //   A unicode-escape-sequence representing a character of the class Cf

            return cat == UnicodeCategory.Format;
        }
    }
}


text:
import logging

from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _

from horizon import forms

from openstack_dashboard.dashboards.project.networks.ports.extensions.\
    allowed_address_pairs import forms as addr_pairs_forms

LOG = logging.getLogger(__name__)

class AddAllowedAddressPair(forms.ModalFormView):
    form_class = addr_pairs_forms.AddAllowedAddressPairForm
    form_id = "addallowedaddresspair_form"
    modal_header = _("Add allowed address pair")
    template_name = 'project/networks/ports/add_addresspair.html'
    context_object_name = 'port'
    submit_label = _("Submit")
    submit_url = "horizon:project:networks:ports:addallowedaddresspairs"
    success_url = 'horizon:project:networks:ports:detail'
    page_title = _("Add allowed address pair")

    def get_success_url(self):
        return reverse(self.success_url, args=(self.kwargs['port_id'],))

    def get_context_data(self, **kwargs):
        context = super(AddAllowedAddressPair, self).get_context_data(**kwargs)
        context["port_id"] = self.kwargs['port_id']
        context['submit_url'] = reverse(self.submit_url,
                                        args=(self.kwargs['port_id'],))
        return context

    def get_initial(self):
        return {'port_id': self.kwargs['port_id']}


text:
import '@testing-library/jest-dom/extend-expect';

beforeEach(() => {
  jest.resetAllMocks();
})


text:
/**
 * @file EngineTest.cpp
 * @brief Main file for tests for Engine
 *
 * @author Michael Albers
 */

#include "gtest/gtest.h"
#include "xercesc/util/PlatformUtils.hpp"

XERCES_CPP_NAMESPACE_USE

class XercesInit
{
  public:
  XercesInit() {XMLPlatformUtils::Initialize();}
  ~XercesInit() {XMLPlatformUtils::Terminate();}
};

int main(int argc, char **argv)
{
  XercesInit xi;
  ::testing::InitGoogleTest(&argc, argv);
  return RUN_ALL_TESTS();
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Errors</title>
<meta name="date" content="2018-11-09">
<link rel="stylesheet" type="text/css" href="../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

org.robolectric.res.android

Class Errors

java.lang.Object

org.robolectric.res.android.Errors

public class Errors
extends java.lang.Object

Field Summary

Fields

Modifier and Type
Field and Description

static int
BAD_INDEX

static int
BAD_TYPE

static int
BAD_VALUE

static int
NAME_NOT_FOUND

static int
NO_ERROR

static int
NO_INIT

static int
NO_MEMORY

static int
UNKNOWN_ERROR

Constructor Summary

Constructors

Constructor and Description

Errors()

Method Summary

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

NO_ERROR

public static final int NO_ERROR

See Also:

Constant Field Values

UNKNOWN_ERROR

public static final int UNKNOWN_ERROR

See Also:

Constant Field Values

BAD_INDEX

public static final int BAD_INDEX

See Also:

Constant Field Values

BAD_TYPE

public static final int BAD_TYPE

See Also:

Constant Field Values

BAD_VALUE

public static final int BAD_VALUE

See Also:

Constant Field Values

NO_MEMORY

public static final int NO_MEMORY

See Also:

Constant Field Values

NAME_NOT_FOUND

public static final int NAME_NOT_FOUND

See Also:

Constant Field Values

NO_INIT

public static final int NO_INIT

See Also:

Constant Field Values

Constructor Detail

Errors

public Errors()

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<?php

namespace Facebook\Libphutil;

/**
 * Abstract base class for implementing objects that behave like arrays. This
 * class wraps a basic array and provides trivial implementations for
 * `Countable`, `ArrayAccess` and `Iterator`, so subclasses need only implement
 * specializations.
 */
abstract class PhutilArray
  extends \Facebook\Libphutil\Phobject
  implements \Countable, \ArrayAccess, \Iterator {

  protected $data = array();

  public function __construct(array $initial_value = array()) {
    $this->data = $initial_value;
  }

/* -(  Conversion  )--------------------------------------------------------- */

  public function toArray() {
    return iterator_to_array($this, true);
  }

/* -(  \Countable Interface  )------------------------------------------------ */

  public function count() {
    return count($this->data);
  }

/* -(  \Iterator Interface  )------------------------------------------------- */

  public function current() {
    return current($this->data);
  }

  public function key() {
    return key($this->data);
  }

  public function next() {
    return next($this->data);
  }

  public function rewind() {
    reset($this->data);
  }

  public function valid() {
    return (key($this->data) !== null);
  }

/* -(  \ArrayAccess Interface  )---------------------------------------------- */

  public function offsetExists($key) {
    return array_key_exists($key, $this->data);
  }

  public function offsetGet($key) {
    return $this->data[$key];
  }

  public function offsetSet($key, $value) {
    $this->data[$key] = $value;
  }

  public function offsetUnset($key) {
    unset($this->data[$key]);
  }

}


text:
using System.Linq;

namespace _04.Numbers_in_Reversed_Order
{
    using System;

    public class Program
    {
        public static void Main()
        {
            var numbers = Console.ReadLine();
            Reverse(numbers);
        }

        public static void Reverse(string numbers)
        {
            for (int i = numbers.Length - 1; i >= 0; i--)
            {
                Console.Write(numbers[i]);
            }
            Console.WriteLine();
        }
    }
}


text:
/**
 * @file FontEditor 命令相关操作
 * @author mengke01(kekee000@gmail.com)
 */

define(
    function (require) {
        var i18n = require('../i18n/i18n');
        var settingSupport = require('../dialog/support');
        var program = require('../widget/program');
        var ajaxFile = require('common/ajaxFile');
        var string = require('common/string');
        var lang = require('common/lang');
        var glyfAdjust = require('fonteditor-core/ttf/util/glyfAdjust');
        var getEmptyttfObject = require('fonteditor-core/ttf/getEmptyttfObject');

        /**
         * 读取在线字体
         *
         * @param {string} type 类型 svg or binary
         * @param {string} url 文件地址
         */
        function readOnlineFont(type, url) {
            ajaxFile({
                type: type === 'svg' ? 'xml' : 'binary',
                url: url,
                onSuccess: function (buffer) {
                    program.loader.load(buffer, {
                        type: type || 'ttf',
                        success: function (imported) {
                            program.loading.hide();
                            program.ttfManager.set(imported);
                            program.data.projectId = null;
                            program.projectViewer.unSelect();
                        }
                    });
                },
                onError: function () {
                    alert(i18n.lang.msg_read_file_error);
                }
            });
        }

        // 延迟focus editor
        var editorDelayFocus = lang.debounce(function () {
            program.editor.focus();
        }, 20);

        // 延迟同步选项
        var fontDelaySync = lang.debounce(function (projectId, ttf, syncConfig) {
            program.loading.show(i18n.lang.msg_syncing, 4000);
            program.sync.addTask(projectId, ttf, syncConfig).then(function (reason) {
                program.loading.show(i18n.lang.msg_sync_success, 400);
            }, function (reason) {
                program.loading.show(i18n.lang.msg_sync_failed + reason.statusInfo + '...', 400);
            });
        }, 500);

        var actions = {

            'undo': function () {
                if (program.editor.isEditing()) {
                    program.editor.undo();
                    editorDelayFocus();
                }
                else {
                    program.ttfManager.undo();
                }
            },

            'redo': function () {
                if (program.editor.isEditing()) {
                    program.editor.redo();
                    editorDelayFocus();
                }
                else {
                    program.ttfManager.redo();
                }
            },

            'new': function () {
                if (program.ttfManager.isChanged() && !window.confirm(i18n.lang.msg_confirm_save_proj)) {
                    return;
                }
                program.ttfManager.set(getEmptyttfObject());
                program.data.projectId = null;
                // 建立项目 提示保存
                actions.save();
            },

            'open': function () {
                $('#font-import').click();
            },

            'import': function () {
                if (program.ttfManager.get()) {
                    $('#font-import').click();
                }
            },

            'export': function (e) {
                if (!e.target.getAttribute('download')) {
                    e.preventDefault();
                }
            },

            'export-file': function (e) {
                if (program.ttfManager.get()) {
                    var target = $(e.target);
                    program.exporter.export(program.ttfManager.get(), {
                        type: target.attr('data-type'),
                        target: target,
                        originEvent: e,
                        error: function () {
                            e.preventDefault();
                        }
                    });
                }
            },

            'sync': function (projectId, ttf, syncConfig) {
                syncConfig = syncConfig || program.project.getConfig(projectId).sync;
                if (syncConfig) {
                    fontDelaySync(program.data.projectId, ttf, syncConfig);
                }
            },

            'save': function () {
                if (program.ttfManager.get()) {
                    var projectId = program.data.projectId;
                    if (projectId) {
                        program.project.update(projectId, program.ttfManager.get())
                        .then(function () {
                            program.ttfManager.setState('saved');
                            program.loading.show(i18n.lang.msg_save_success, 400);
                            var syncConfig = program.project.getConfig(projectId).sync;
                            if (syncConfig && syncConfig.autoSync) {
                                actions.sync(projectId, program.ttfManager.get(), syncConfig);
                            }
                        }, function () {
                            program.loading.show(i18n.lang.msg_save_failed, 1000);
                        });

                    }
                    else {
                        var name = program.ttfManager.get().name.fontFamily || '';
                        if ((name = window.prompt(i18n.lang.msg_input_proj_name, name))) {

                            name = string.encodeHTML(name);
                            program.project.add(name, program.ttfManager.get())
                            .then(function (id) {
                                program.data.projectId = id;
                                program.ttfManager.setState('new');
                                program.projectViewer.show(program.project.items(), id);
                                program.loading.show(i18n.lang.msg_save_success, 400);

                            }, function () {
                                program.loading.show(i18n.lang.msg_save_failed, 400);
                            });
                        }
                    }
                }
            },

            'add-new': function () {
                if (program.ttfManager.get()) {
                    var selected = program.viewer.getSelected();
                    program.ttfManager.insertGlyf({}, selected[0]);
                }
                else {
                    // 没有项目 先建立一个项目
                    actions.new();
                }
            },

            'add-online': function () {
                var SettingOnline = settingSupport.online;
                !new SettingOnline({
                    onChange: function (url) {
                        if (program.ttfManager.isChanged() && !window.confirm(i18n.lang.msg_confirm_save_proj)) {
                            return;
                        }
                        program.loading.show(i18n.lang.msg_loading, 1000);

                        // 此处延迟处理
                        setTimeout(function () {
                            var type = url.slice(url.lastIndexOf('.') + 1);
                            var fontUrl = url;

                            if (/^https?:\/\//i.test(url)) {
                                fontUrl = string.format(program.readOnline, ['font', encodeURIComponent(url)]);
                            }
                            readOnlineFont(type, fontUrl);
                        }, 20);
                    }
                }).show();
            },

            'add-url': function () {
                var SettingUrl = settingSupport.url;
                !new SettingUrl({
                    onChange: function (url) {
                        if (program.ttfManager.isChanged() && !window.confirm(i18n.lang.msg_confirm_save_proj)) {
                            return;
                        }

                        program.loading.show(i18n.lang.msg_loading, 1000);
                        // 此处延迟处理
                        setTimeout(function () {
                            var fontUrl = string.format(program.readOnline, ['font', encodeURIComponent(url)]);
                            readOnlineFont(url.slice(url.lastIndexOf('.') + 1), fontUrl);
                        }, 20);
                    }
                }).show();
            },

            'preview': function (e) {
                var ttf = program.ttfManager.get();
                if (ttf) {
                    var format = e.target.getAttribute('data-format');
                    program.previewer.load(ttf, format);
                }
            },

            'setting-name': function () {
                var ttf = program.ttfManager.get();
                if (ttf) {
                    var SettingName = settingSupport.name;
                    !new SettingName({
                        onChange: function (setting) {
                            program.ttfManager.setInfo(setting);
                        }
                    }).show($.extend({}, ttf.head, ttf.name));
                }
            },

            'setting-metrics': function () {
                var ttf = program.ttfManager.get();
                if (ttf) {
                    var SettingMetrics = settingSupport.metrics;
                    !new SettingMetrics({
                        onChange: function (setting) {
                            program.ttfManager.setMetrics(setting);
                        }
                    }).show($.extend({}, ttf['OS/2'], ttf.hhea, ttf.post));
                }
            },

            'setting-glyf-name': function () {
                if (program.ttfManager.get()) {
                    if (window.confirm(i18n.lang.msg_confirm_gen_names)) {
                        program.ttfManager.genGlyfName(program.viewer.getSelected());
                    }
                }
            },

            'setting-glyf-clearname': function () {
                if (program.ttfManager.get()) {
                    program.ttfManager.clearGlyfName(program.viewer.getSelected());
                }
            },

            'setting-optimize': function () {
                if (program.ttfManager.get()) {
                    var result = program.ttfManager.optimize();
                    if (true !== result) {
                        alert(result.message);
                    }
                }
            },

            'setting-sort': function () {
                if (program.ttfManager.get()) {
                    var result = program.ttfManager.sortGlyf();
                    if (true !== result) {
                        alert(result.message);
                    }
                }
            },

            'setting-compound2simple': function () {
                if (program.ttfManager.get()) {
                    program.ttfManager.compound2simple(program.viewer.getSelected());
                }
            },

            'setting-editor': function () {
                var SettingEditor = settingSupport.editor;
                !new SettingEditor({
                    onChange: function (setting) {
                        program.setting.set('editor', setting, setting.saveSetting);
                        setTimeout(function () {
                            program.viewer.setSetting(setting.viewer);
                            program.editor.setSetting(setting.editor);
                        }, 20);
                    }
                }).show(program.setting.get('editor'));
            },

            'import-pic': function () {
                var SettingEditor = settingSupport['import-pic'];
                if (program.ttfManager.get()) {
                    !new SettingEditor({
                        onChange: function (setting) {
                            if (setting.contours) {

                                if (program.editor.isVisible()) {
                                    program.editor.execCommand('addcontours', setting.contours, {
                                        scale: 1,
                                        selected: true
                                    });
                                    editorDelayFocus();
                                }
                                else {
                                    var selected = program.viewer.getSelected();
                                    program.ttfManager.insertGlyf(glyfAdjust({
                                        contours: setting.contours
                                    }, 1, 1, 0, 0, false), selected[0]);
                                }
                            }
                        }
                    }).show();
                }
            },

            'setting-import-and-export': function () {
                var SettingEditor = settingSupport.ie;
                !new SettingEditor({
                    onChange: function (setting) {
                        program.setting.set('ie', setting, setting.saveSetting);
                    }
                }).show(program.setting.get('ie'));
            }
        };

        return actions;
    }
);


text:
let fs = require('fs');
let assert = require('assert');

let babel7 = require('@babel/core');

let StripDataTestPropertiesPlugin6 = require('../strip-data-test-properties-plugin6');

function testFixture(name) {
  it(`fixture: ${name}`, function () {
    let fixturePath = `${__dirname}/fixtures/${name}/fixture.js`;
    let expectedPath = `${__dirname}/fixtures/${name}/expected7.js`;

    let expected = fs.readFileSync(expectedPath, 'utf8').replace(/\r\n/g, '\n');

    let result = babel7.transformFileSync(fixturePath, {
      plugins: [StripDataTestPropertiesPlugin6],
    });

    assert.strictEqual(result.code.trim(), expected.trim());
  });
}

describe('StripDataTestProperties plugin', function () {
  testFixture('default');
});


text:
<!DOCTYPE html>

	<title>GRO Recommendations</title>

	<meta charset="utf-8" />
	<meta name="viewport" content="width=device-width, initial-scale=1.0">

	<link rel="shortcut icon" type="image/x-icon" href="docs/images/favicon.ico" />

    <link rel="stylesheet" href="https://unpkg.com/leaflet@1.0.3/dist/leaflet.css" integrity="sha512-07I2e+7D8p6he1SIM+1twR5TIrhUQn9+I6yjqD53JQjFiMf8EtC93ty0/5vJTZGF8aAocvHYNEDJajGdNx1IsQ==" crossorigin=""/>